fi.joensuu.cs.tra
Class Graph
java.lang.Object
fi.joensuu.cs.tra.AbstractGraph
fi.joensuu.cs.tra.Graph
- All Implemented Interfaces:
- Iterable
public class Graph
- extends AbstractGraph
- implements Iterable
A Graph or an undirected graph is an ordered pair
G := (V, E) with
Graph is simply a subclass of the abstract class
AbstractGraph
that sets it up in undirected mode.
Example:
boolean isConnected(Graph graph) {
colorAllVertices(graph, Graph.WHITE);
dfsColor(graph.firstVertex, Graph.BLACK);
for (Vertex vertex : graph.vertices())
if (vertex.getColor() == Graph.WHITE)
return false;
return true;
}
See DiGraph
documentation for dfsColor(...)
- See Also:
Vertex
,
Edge
,
DiGraph
,
AbstractGraph
Constructor Summary |
Graph()
|
Methods inherited from class fi.joensuu.cs.tra.AbstractGraph |
addVertex, addVertex, addVertex, addVertex, addVertex, addVertex, addVertex, addVertex, addVertex, addVertex, addVertex, addVertex, edgeIterator, edges, firstVertex, isDiGraph, iterator, removeVertex, size, toString, vertexCount, vertexIterator, vertices |
Graph
public Graph()