|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.uci.ics.jung.algorithms.shortestpath.BFSDistanceLabeler<V,E>
public class BFSDistanceLabeler<V,E>
Labels each node in the graph according to the BFS distance from the start node(s). If nodes are unreachable, then they are assigned a distance of -1. All nodes traversed at step k are marked as predecessors of their successors traversed at step k+1.
Running time is: O(m)
Constructor Summary | |
---|---|
BFSDistanceLabeler()
Creates a new BFS labeler for the specified graph and root set The distances are stored in the corresponding Vertex objects and are of type MutableInteger |
Method Summary | |
---|---|
int |
getDistance(Hypergraph<V,E> g,
V v)
Given a vertex, returns the shortest distance from any node in the root set to v |
Map<V,Number> |
getDistanceDecorator()
Returns a map from vertices to minimum distances from the original source(s). |
Set<V> |
getPredecessors(V v)
Returns set of predecessors of the given vertex |
Set<V> |
getUnvisitedVertices()
Returns the set of all vertices that were not visited |
List<V> |
getVerticesInOrderVisited()
Returns the list of vertices visited in order of traversal |
protected void |
initialize(Hypergraph<V,E> g,
Set<V> rootSet)
|
void |
labelDistances(Hypergraph<V,E> graph,
Set<V> rootSet)
Computes the distances of all the node from the starting root nodes. |
void |
labelDistances(Hypergraph<V,E> graph,
V root)
Computes the distances of all the node from the specified root node. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BFSDistanceLabeler()
Method Detail |
---|
public List<V> getVerticesInOrderVisited()
public Set<V> getUnvisitedVertices()
public int getDistance(Hypergraph<V,E> g, V v)
v
- the vertex whose distance is to be retrieved
public Set<V> getPredecessors(V v)
v
- the vertex whose predecessors are to be retrieved
protected void initialize(Hypergraph<V,E> g, Set<V> rootSet)
public void labelDistances(Hypergraph<V,E> graph, Set<V> rootSet)
graph
- the graph to labelrootSet
- the set of starting vertices to traverse frompublic void labelDistances(Hypergraph<V,E> graph, V root)
graph
- the graph to labelroot
- the single starting vertex to traverse frompublic Map<V,Number> getDistanceDecorator()
labelDistances
in order to contain valid data.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |