www.sdmetrics.com

com.sdmetrics.metrics
Class ChangeDirectionsAdapter<T>

java.lang.Object
  extended by com.sdmetrics.metrics.ChangeDirectionsAdapter<T>
Type Parameters:
T - Type of the nodes on the graph
All Implemented Interfaces:
StronglyConnectedComponents.Graph<T>

public class ChangeDirectionsAdapter<T>
extends java.lang.Object
implements StronglyConnectedComponents.Graph<T>

Constructs a new graph from an existing one, reversing or removing the directions of the edges.

The new graph has the same set of nodes as the original graph, and for every edge (A,B) from node A to node B in the original graph


Constructor Summary
ChangeDirectionsAdapter(StronglyConnectedComponents.Graph<T> graph, boolean makeUndirected)
           
 
Method Summary
 java.util.Collection<T> getNeighbors(T o)
          Obtains, for a node, the set of nodes to which it has an outgoing edge.
 java.util.Collection<T> getNodes()
          Retrieves the set of nodes of the graph.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChangeDirectionsAdapter

public ChangeDirectionsAdapter(StronglyConnectedComponents.Graph<T> graph,
                               boolean makeUndirected)
                        throws SDMetricsException
Parameters:
graph - The original graph.
makeUndirected - Set to true to obtain an undirected graph, or false to obtain the graph with reversed edges.
Throws:
SDMetricsException - The neighbors for a node could not be determined
Method Detail

getNodes

public java.util.Collection<T> getNodes()
Description copied from interface: StronglyConnectedComponents.Graph
Retrieves the set of nodes of the graph.

Specified by:
getNodes in interface StronglyConnectedComponents.Graph<T>
Returns:
A collection of objects that constitute the nodes of the graph.

getNeighbors

public java.util.Collection<T> getNeighbors(T o)
Description copied from interface: StronglyConnectedComponents.Graph
Obtains, for a node, the set of nodes to which it has an outgoing edge.

Specified by:
getNeighbors in interface StronglyConnectedComponents.Graph<T>
Parameters:
o - The node for which to obtain the neighbor nodes.
Returns:
A collection of the neighbor nodes to which node has an outgoing edge.

www.sdmetrics.com