|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--Graph
This represents a mathematical object graph as lists of neighbors. Graph is a pair (V,E), where V is a set of vertices and V is a set of edges. Each edge e is a pair of vertices e = (v1 , v2)
| Field Summary | |
static int |
MAXX
Width of virtual Panel used to place vertices |
static int |
MAXY
Height of virtual Panel used to place vertices |
int |
moves
A number of moves after initialization or last randomStates() |
| Constructor Summary | |
Graph()
Creates an empty graph without vertices |
|
Graph(Graph g,
Vertex v)
creates a new graph with the same structure as g, but with vertices of the same type as v |
|
Graph(Vertex v,
int n)
Creates a tree with n vertices |
|
Graph(Vertex v,
int n,
float p)
Creates a random graph with n vertices, where each edge appears with probability p |
|
Graph(Vertex v,
int n1,
int n2,
float p)
Creates a random bipartite graph with n=n1+n2 vertices, where each edge appears with probability p |
|
| Method Summary | |
boolean |
addEdge(Vertex u,
Vertex v)
Tries to add an edge between two specified vertices. |
boolean |
addRandomEdge()
Tries to add random edge to a graph. |
void |
addVertex(Vertex v,
java.lang.String name)
Add a vertex v to a graph as isolated one. |
void |
addVertex(Vertex v,
java.lang.String name,
float p)
Add a vertex v to a graph with some edges. |
void |
addVertex(Vertex v,
java.lang.String name,
int d)
Add a vertex v to a graph with degree d. |
int |
countEdges()
Count number of edges in a graph. |
int |
delta()
Count maximum degree in a graph. |
Vertex |
firstAvailable()
First available vertex in a graph |
void |
getCoordinates(int maxX,
int maxY)
Gets Coordinates given by graphplace, to use this method graphplace must be available, and writing files must be allowed. |
java.util.Iterator |
iterator()
Iterator over vertices of a graph. |
void |
paintStates(java.awt.Graphics graphics)
Paint vertices in a graph using graphics |
void |
print()
Print graph info. |
void |
printStates()
Print vertices in a graph |
Vertex |
randomAvailable()
Chooses one of the available vertices in a graph |
void |
randomCoordinates(int maxX,
int maxY)
Random coordinates of all vertices in a graph |
void |
randomStates()
Set states of vertices in a random manner. |
void |
setFactors(int maxX,
int maxY)
Each vertex in a graph has its coordinates. |
void |
setRadius(int r)
Each vertex in a graph is painted as a circle with radius in pixels. |
int |
size()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int MAXX
Vertex.getXCoordinate(),
setFactors(int, int),
Constant Field Valuespublic static final int MAXY
Vertex.getYCoordinate(),
setFactors(int, int),
Constant Field Valuespublic int moves
randomStates(),
Vertex.move(int)| Constructor Detail |
public Graph()
public Graph(Vertex v,
int n)
public Graph(Graph g,
Vertex v)
public Graph(Vertex v,
int n,
float p)
public Graph(Vertex v,
int n1,
int n2,
float p)
| Method Detail |
public void addVertex(Vertex v,
java.lang.String name)
public void addVertex(Vertex v,
java.lang.String name,
int d)
public void addVertex(Vertex v,
java.lang.String name,
float p)
public int size()
public boolean addEdge(Vertex u,
Vertex v)
public boolean addRandomEdge()
public void print()
Vertex.print()public int delta()
public int countEdges()
public void setRadius(int r)
Vertex.paintState(java.awt.Graphics),
Vertex.setRadius(int),
Vertex.getRadius()public Vertex firstAvailable()
iterator(),
Vertex.agree()public Vertex randomAvailable()
Vertex.agree()public void randomStates()
Vertex.randomState(java.util.Random)public void printStates()
Vertex.printState()public void paintStates(java.awt.Graphics graphics)
Vertex.paintState(java.awt.Graphics)public java.util.Iterator iterator()
public void setFactors(int maxX,
int maxY)
public void getCoordinates(int maxX,
int maxY)
public void randomCoordinates(int maxX,
int maxY)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||