|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.graphstream.algorithm.AbstractSpanningTree
public abstract class AbstractSpanningTree
Base for spanning tree algorithms.
The result is stored in an edge attribute which name is defined by
flagAttribute
and value is flagOn
if the edge is in the
tree or flagOff
if not.
Spanning tree algorithms have to extend this class and to implements the
makeTree()
method. edgeOn(Edge)
and edgeOff(Edge)
methods have to be used to properly tag edge.
A call to compute reset the values of edges attribute. Then a call to
makeTree()
is done.
Using the CSS, it is possible to highlight the spanning tree result using classes. Considering two css edge classes have been defined in the CSS, for example :
edge .in { size: 3px; fill-color: black; } edge .notin { size: 2px; fill-color: gray; }
You can tell the algorithm to set up the value of the "ui.class" attribute of edges to "in" when the edge is in the tree or "notin" when edge is not in the tree.
This can be done by setting the flagAttribute
of the algorithm using
the setter setFlagAttribute(String)
and the flag values
flagOn
and flagOff
with setFlagOn(Object)
and
setFlagOff(Object)
setters.
Graph graph = ...; AbstractSpanningTree sp = ...; ... sp.setFlagAttribute("ui.class"); sp.setFlagOn("in"); sp.setFlagOff("notin"); sp.init(graph); sp.compute(); graph.display(); ..
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 |
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. |
void |
init(org.graphstream.graph.Graph graph)
Initialization of the algorithm. |
void |
setFlagAttribute(String newFlagAttribute)
Set the flag attribute. |
void |
setFlagOff(Object newFlagOff)
Set value used to set that an edge is not in the spanning tree. |
void |
setFlagOn(Object newFlagOn)
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 |
---|
public AbstractSpanningTree()
public AbstractSpanningTree(String flagAttribute)
flagAttribute
- attribute used to compare edgespublic AbstractSpanningTree(String flagAttribute, Object flagOn, Object flagOff)
flagAttribute
- attribute used to set if an edge is in the spanning treeflagOn
- value of the flagAttribute if edge is in the spanning
treeflagOff
- value of the flagAttribute if edge is not in the
spanning treeMethod Detail |
---|
public String getFlagAttribute()
public void setFlagAttribute(String newFlagAttribute)
newFlagAttribute
- new attribute usedpublic Object getFlagOn()
public void setFlagOn(Object newFlagOn)
newFlagOn
- on valuepublic Object getFlagOff()
public void setFlagOff(Object newFlagOff)
newFlagOff
- off valuepublic void init(org.graphstream.graph.Graph graph)
Algorithm
Algorithm.compute()
method to initialize or reset the algorithm according
to the new given graph.
init
in interface Algorithm
graph
- The graph this algorithm is using.public void compute()
Algorithm
Algorithm.init(Graph)
method has to be called
before computing.
compute
in interface Algorithm
Algorithm.init(Graph)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |