|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfr.umlv.roadcoloring.graph.Graph
public class Graph
Manage a graph strongly connected, aperiodic, 2 colored (blue and red) run coloring() for change the coloring in order to have a synchronized word Can be generated randomly if size n, or from a file The syntax of the graph is : n i r b with n size of the graph and, for each node i, the red edge and the blue edge Can be seen by dotty()
Field Summary | |
---|---|
protected static byte |
BLUEEDGE
|
protected static byte |
REDEDGE
|
Constructor Summary | |
---|---|
protected |
Graph(Graph g)
Create a graph from another graph create array but not the edges |
|
Graph(int n,
java.lang.String generatorPgrm)
Generate a randomly acceptable graph of size n |
|
Graph(java.lang.String fileName)
Create a graph from a file |
Method Summary | |
---|---|
int |
browse(int startNode,
java.lang.String word)
Browse the word in the graph, start from the node graph Word is a succession of R or B. |
void |
coloring()
eventually change the colloring of the graph in order to be synchronizing compute the quotient graph until it's a size > 1 compute the quotient from the classes. |
void |
dotty()
launch dotty and print the graph |
protected void |
edgeSwap(int node)
flip the edges of the node |
int |
get(int index,
byte color)
Get the next by color of index |
int |
getBlue(int index)
get the next by blue for index |
int[] |
getClasses()
get the classes for each node |
protected int |
getNodeClass(int node)
get the class of a node from the initial graph -1 is the status of a node not in a class (so return herself) |
int |
getRed(int index)
get the next by red for index |
int |
getSize()
get graph size |
protected int |
getSucessorByRed(int start,
int len)
browse the red edge len time from the start node |
boolean |
isAcceptable()
tell if the graph is acceptable (strongly connected and aperiodic) |
boolean |
isAperiodic()
tell if the graph is aperiodic |
boolean |
isStronglyConnected()
test if this graph is strongly connected |
protected void |
setBlue(int index,
int value)
set the next by blue of index |
protected void |
setRed(int index,
int value)
set the next by red of index |
java.lang.String |
toDot()
usefull for dotty |
java.lang.String |
toString()
|
boolean |
verifySyncWord(java.lang.String word)
Check if the word synchronize the graph (if browse the word from each node, they're going on the same node) |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static final byte REDEDGE
protected static final byte BLUEEDGE
Constructor Detail |
---|
public Graph(int n, java.lang.String generatorPgrm) throws java.io.IOException
n
- size of graphgeneratorPgrm
- a program for generate a randomly graph. If null, use Random JDK classes
java.io.IOException
protected Graph(Graph g)
g
- public Graph(java.lang.String fileName)
fileName
- name of the graph
{@link
- IllegalArgumentException} if the graph is not acceptableMethod Detail |
---|
public int getSize()
public int getRed(int index)
index
- node
public int getBlue(int index)
index
- node
public int get(int index, byte color)
index
- nodecolor
- can by BLUEEDGE or REDEDGE
protected void setRed(int index, int value)
index
- start nodevalue
- node next by redprotected void setBlue(int index, int value)
index
- start nodevalue
- node next by bluepublic int[] getClasses()
protected int getNodeClass(int node)
node
- node which we seach class
public boolean isStronglyConnected()
public boolean isAperiodic()
public boolean isAcceptable()
public void coloring()
protected void edgeSwap(int node)
node
- node to be flipprotected int getSucessorByRed(int start, int len)
start
- start nodelen
- length in the red edges
public int browse(int startNode, java.lang.String word)
startNode
- start node in the graphword
- word to browse
public boolean verifySyncWord(java.lang.String word)
word
- synchronize word to be test
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toDot()
public void dotty()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |