Click or drag to resize
SymbolGraph Class

The SymbolGraph class represents an undirected graph, where the vertex names are arbitrary strings. By providing mappings between string vertex names and integers, it serves as a wrapper around the data type, which assumes the vertex names are integers between 0 and V - 1. It also supports initializing a symbol graph from a file.

This implementation uses an to map from strings to integers, an array to map from integers to strings, and a to store the underlying graph. The Index and Contains operations take time proportional to log V, where V is the number of vertices. The Name operation takes constant time.

Inheritance Hierarchy
SystemObject
  Algs4NetSymbolGraph

Namespace: Algs4Net
Assembly: Algs4Net (in Algs4Net.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
C#
public class SymbolGraph

The SymbolGraph type exposes the following members.

Constructors
  NameDescription
Public methodSymbolGraph
Initializes a graph from a file using the specified delimiter. Each line in the file contains the name of a vertex, followed by a list of the names of the vertices adjacent to that vertex, separated by the delimiter.
Top
Properties
  NameDescription
Public propertyG
Returns the graph assoicated with the symbol graph. It is the client's responsibility not to mutate the graph.
Top
Methods
  NameDescription
Public methodContains
Does the graph contain the vertex named s?
Public methodIndex
Returns the integer associated with the vertex named s.
Public methodStatic memberMainTest
Demo test the SymbolGraph data type.
Public methodName
Returns the name of the vertex associated with the integer v.
Top
Remarks

For additional documentation, see Section 4.1 of Algorithms, 4th Edition by Robert Sedgewick and Kevin Wayne.

This class is a C# port from the original Java class SymbolGraph implementation by the respective authors.

See Also