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.
Namespace: Algs4Net
public class SymbolDigraph
The SymbolDigraph type exposes the following members.
Name | Description | |
---|---|---|
![]() | SymbolDigraph |
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. |
Name | Description | |
---|---|---|
![]() | G |
Returns the digraph assoicated with the symbol graph. It is the client's responsibility
not to mutate the digraph. |
Name | Description | |
---|---|---|
![]() | Contains |
Does the digraph contain the vertex named s? |
![]() | Index |
Returns the integer associated with the vertex named s. |
![]() ![]() | MainTest |
Demo test the SymbolDigraph data type. |
![]() | Name |
Returns the name of the vertex associated with the integer v. |
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.