

PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 
java.lang.Object org.jscience.computing.graph.algorithms.ConnectivityInspector
public class ConnectivityInspector
Allows obtaining various connectivity aspects of a graph. The inspected
graph is specified at construction time and cannot be modified.
Currently, the inspector supports connected components for an undirected
graph and weakly connected components for a directed graph. To find
strongly connected components, use StrongConnectivityInspector
instead.
The inspector methods work in a lazy fashion: no computation is performed unless immediately necessary. Computation are done once and results and cached within this class for future need.
The inspector is also a GraphListener
. If
added as a listener to the inspected graph, the inspector will amend
internal cached results instead of recomputing them. It is efficient when a
few modifications are applied to a large graph. If many modifications are
expected it will not be efficient due to added overhead on graph update
operations. If inspector is added as listener to a graph other than the one
it inspects, results are undefined.
Constructor Summary  

ConnectivityInspector(DirectedGraph g)
Creates a connectivity inspector for the specified directed graph. 

ConnectivityInspector(UndirectedGraph g)
Creates a connectivity inspector for the specified undirected graph. 
Method Summary  

java.util.Set 
connectedSetOf(java.lang.Object vertex)
Returns a set of all vertices that are in the maximally connected component together with the specified vertex. 
java.util.List 
connectedSets()
Returns a list of Set s, where each set contains all
vertices that are in the same maximally connected component. 
void 
edgeAdded(GraphEdgeChangeEvent e)
Notifies that an edge has been added to the graph. 
void 
edgeRemoved(GraphEdgeChangeEvent e)
Notifies that an edge has been removed from the graph. 
boolean 
isGraphConnected()
Test if the inspected graph is connected. 
boolean 
pathExists(java.lang.Object sourceVertex,
java.lang.Object targetVertex)
Tests if there is a path from the specified source vertex to the specified target vertices. 
void 
vertexAdded(GraphVertexChangeEvent e)
Notifies that a vertex has been added to the graph. 
void 
vertexRemoved(GraphVertexChangeEvent e)
Notifies that a vertex has been removed from the graph. 
Methods inherited from class java.lang.Object 

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 
Constructor Detail 

public ConnectivityInspector(UndirectedGraph g)
g
 the graph for which a connectivity inspector to be created.public ConnectivityInspector(DirectedGraph g)
g
 the graph for which a connectivity inspector to be created.Method Detail 

public boolean isGraphConnected()
true
if and only if inspected graph is connected.public java.util.Set connectedSetOf(java.lang.Object vertex)
vertex
 the vertex for which the connected set to be returned.
public java.util.List connectedSets()
Set
s, where each set contains all
vertices that are in the same maximally connected component. All graph
vertices occur in exactly one set. For more on maximally connected
component, see
http://www.nist.gov/dads/HTML/maximallyConnectedComponent.html.
Set
s, where each set contains all
vertices that are in the same maximally connected component.public void edgeAdded(GraphEdgeChangeEvent e)
GraphListener
edgeAdded
in interface GraphListener
e
 the edge event.GraphListener.edgeAdded(GraphEdgeChangeEvent)
public void edgeRemoved(GraphEdgeChangeEvent e)
GraphListener
edgeRemoved
in interface GraphListener
e
 the edge event.GraphListener.edgeRemoved(GraphEdgeChangeEvent)
public boolean pathExists(java.lang.Object sourceVertex, java.lang.Object targetVertex)
Note: Future versions of this method might not ignore edge directions for directed graphs.
sourceVertex
 one end of the path.targetVertex
 another end of the path.
true
if and only if there is a path from the source
vertex to the target vertex.public void vertexAdded(GraphVertexChangeEvent e)
VertexSetListener
vertexAdded
in interface VertexSetListener
e
 the vertex event.VertexSetListener.vertexAdded(GraphVertexChangeEvent)
public void vertexRemoved(GraphVertexChangeEvent e)
VertexSetListener
vertexRemoved
in interface VertexSetListener
e
 the vertex event.VertexSetListener.vertexRemoved(GraphVertexChangeEvent)


PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 