Click or drag to resize
SymbolDigraph Class

The SymbolDigraph class represents a digraph, 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 digraph 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
  Algs4NetSymbolDigraph

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

The SymbolDigraph type exposes the following members.

Constructors
  NameDescription
Public methodSymbolDigraph
Initializes a digraph 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 digraph assoicated with the symbol graph. It is the client's responsibility not to mutate the digraph.
Top
Methods
  NameDescription
Public methodContains
Does the digraph contain the vertex named s?
Public methodIndex
Returns the integer associated with the vertex named s.
Public methodStatic memberMainTest
Demo test the SymbolDigraph data type.
Public methodName
Returns the name of the vertex associated with the integer v.
Top
Remarks

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

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

See Also