public class SymbolGraph extends Object
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
Graph
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 ST
to map from strings to integers,
an array to map from integers to strings, and a Graph
to store
the underlying graph.
The indexOf and contains operations take time
proportional to log V, where V is the number of vertices.
The nameOf operation takes constant time.
For additional documentation, see Section 4.1 of Algorithms, 4th Edition by Robert Sedgewick and Kevin Wayne.
Constructor and Description 

SymbolGraph(String filename,
String delimiter)
Initializes a graph from a file using the specified delimiter.

Modifier and Type  Method and Description 

boolean 
contains(String s)
Does the graph contain the vertex named
s ? 
Graph 
G()
Deprecated.
Replaced by
graph() . 
Graph 
graph()
Returns the graph assoicated with the symbol graph.

int 
index(String s)
Deprecated.
Replaced by
indexOf(String) . 
int 
indexOf(String s)
Returns the integer associated with the vertex named
s . 
static void 
main(String[] args)
Unit tests the
SymbolGraph data type. 
String 
name(int v)
Deprecated.
Replaced by
nameOf(int) . 
String 
nameOf(int v)
Returns the name of the vertex associated with the integer
v . 
public SymbolGraph(String filename, String delimiter)
filename
 the name of the filedelimiter
 the delimiter between fieldspublic boolean contains(String s)
s
?s
 the name of a vertextrue
if s
is the name of a vertex, and false
otherwise@Deprecated public int index(String s)
indexOf(String)
.s
.s
 the name of a vertexs
public int indexOf(String s)
s
.s
 the name of a vertexs
@Deprecated public String name(int v)
nameOf(int)
.v
.v
 the integer corresponding to a vertex (between 0 and V  1)v
IllegalArgumentException
 unless 0 <= v < V
public String nameOf(int v)
v
.v
 the integer corresponding to a vertex (between 0 and V  1)v
IllegalArgumentException
 unless 0 <= v < V
@Deprecated public Graph G()
graph()
.public Graph graph()
public static void main(String[] args)
SymbolGraph
data type.args
 the commandline arguments