org.graphstream.algorithm
Class AbstractSpanningTree

java.lang.Object
  extended by org.graphstream.algorithm.AbstractSpanningTree
All Implemented Interfaces:
Algorithm, SpanningTree
Direct Known Subclasses:
Dijkstra, Kruskal

public abstract class AbstractSpanningTree
extends Object
implements SpanningTree

Author:
stefan

Constructor Summary
AbstractSpanningTree()
          Create a new SpanningTree algorithm.
AbstractSpanningTree(String flagAttribute)
          Create a new SpanningTree algorithm.
AbstractSpanningTree(String flagAttribute, Object flagOn, Object flagOff)
          Create a new SpanningTree algorithm.
 
Method Summary
 void clear()
          Removes the tags of all edges.
 void compute()
          Run the algorithm.
 String getFlagAttribute()
          Get key attribute which will be used to set if edges are in the spanning tree, or not.
 Object getFlagOff()
          Get value used to set that an edge is not in the spanning tree.
 Object getFlagOn()
          Get value used to set that an edge is in the spanning tree.
<T extends org.graphstream.graph.Edge>
Iterable<T>
getTreeEdges()
          Iterable view of the spanning tree edges.
abstract
<T extends org.graphstream.graph.Edge>
Iterator<T>
getTreeEdgesIterator()
          An iterator on the tree edges.
 void init(org.graphstream.graph.Graph graph)
          Initialization of the algorithm.
 void setFlagAttribute(String flagAttribute)
          Set the flag attribute.
 void setFlagOff(Object flagOff)
          Set value used to set that an edge is not in the spanning tree.
 void setFlagOn(Object flagOn)
          Set value used to set that an edge is in the spanning tree.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractSpanningTree

public AbstractSpanningTree()
Create a new SpanningTree algorithm. By default edges are not tagged.


AbstractSpanningTree

public AbstractSpanningTree(String flagAttribute)
Create a new SpanningTree algorithm. Default flag attribute values are true for edges in the tree and false for the remaining edges.

Parameters:
flagAttribute - attribute used to compare edges

AbstractSpanningTree

public AbstractSpanningTree(String flagAttribute,
                            Object flagOn,
                            Object flagOff)
Create a new SpanningTree algorithm.

Parameters:
flagAttribute - attribute used to set if an edge is in the spanning tree
flagOn - value of the flagAttribute if edge is in the spanning tree
flagOff - value of the flagAttribute if edge is not in the spanning tree
Method Detail

getFlagAttribute

public String getFlagAttribute()
Description copied from interface: SpanningTree
Get key attribute which will be used to set if edges are in the spanning tree, or not.

Specified by:
getFlagAttribute in interface SpanningTree
Returns:
flag attribute

setFlagAttribute

public void setFlagAttribute(String flagAttribute)
Description copied from interface: SpanningTree
Set the flag attribute.

Specified by:
setFlagAttribute in interface SpanningTree
Parameters:
flagAttribute - New attribute used. If null edges are not tagged.

getFlagOn

public Object getFlagOn()
Description copied from interface: SpanningTree
Get value used to set that an edge is in the spanning tree.

Specified by:
getFlagOn in interface SpanningTree
Returns:
on value

setFlagOn

public void setFlagOn(Object flagOn)
Description copied from interface: SpanningTree
Set value used to set that an edge is in the spanning tree.

Specified by:
setFlagOn in interface SpanningTree
Parameters:
flagOn - on value. If null edges in the tree are not tagged.

getFlagOff

public Object getFlagOff()
Description copied from interface: SpanningTree
Get value used to set that an edge is not in the spanning tree.

Specified by:
getFlagOff in interface SpanningTree
Returns:
off value

setFlagOff

public void setFlagOff(Object flagOff)
Description copied from interface: SpanningTree
Set value used to set that an edge is not in the spanning tree.

Specified by:
setFlagOff in interface SpanningTree

getTreeEdgesIterator

public abstract <T extends org.graphstream.graph.Edge> Iterator<T> getTreeEdgesIterator()
Description copied from interface: SpanningTree
An iterator on the tree edges.

Specified by:
getTreeEdgesIterator in interface SpanningTree
Returns:
An iterator on the tree edges

getTreeEdges

public <T extends org.graphstream.graph.Edge> Iterable<T> getTreeEdges()
Description copied from interface: SpanningTree
Iterable view of the spanning tree edges. This implementation uses SpanningTree.getTreeEdgesIterator().

Specified by:
getTreeEdges in interface SpanningTree
Returns:
Iterable view of the tree edges.

clear

public void clear()
Description copied from interface: SpanningTree
Removes the tags of all edges. Use this method to save memory if the spanning tree is used no more.

Specified by:
clear in interface SpanningTree

init

public void init(org.graphstream.graph.Graph graph)
Description copied from interface: Algorithm
Initialization of the algorithm. This method has to be called before the Algorithm.compute() method to initialize or reset the algorithm according to the new given graph.

Specified by:
init in interface Algorithm
Parameters:
graph - The graph this algorithm is using.

compute

public void compute()
Description copied from interface: Algorithm
Run the algorithm. The Algorithm.init(Graph) method has to be called before computing.

Specified by:
compute in interface Algorithm
See Also:
Algorithm.init(Graph)


Copyright © 2012. All Rights Reserved.