|
Jedit 4.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.bsu.cs.graph.JavaGraph
The base class for implementing a graph - consists of a set of vertices, a set of edges, and a graph type.
Serializable
,
Serialized FormField Summary | |
static int |
DIGRAPH
The flag for a directed Graph |
static int |
GRAPH
The flag for an undirected Graph |
static int |
MULTIGRAPH
Not currently in use |
static int |
POLYGON
Not currently in use |
Constructor Summary | |
JavaGraph()
Default constructor. |
|
JavaGraph(int v,
JavaGraph g1)
Constructs a new graph from the component containing vertex v in graph g1. |
|
JavaGraph(JavaGraph source)
Cloning constructor. |
|
JavaGraph(JavaGraph g1,
JavaGraph g2)
Constructs a new graph from two graphs (combines them into one graph with two components). |
Method Summary | |
void |
addComponent(JavaGraph g)
Adds g as a component to the JavaGraph. |
void |
addEdge(double weight,
int from,
int to)
Adds an edge from the Vertex with the first index to the Vertex with the second index and sets the new Edge's weight to the specified value. |
void |
addEdge(int from,
int to)
Adds an edge from the Vertex with the first index to the Vertex with the second index. |
void |
addVertex()
Adds a single vertex with default properties |
void |
addVertex(Point location)
Adds a new Vertex to the graph and moves it to the Point location. |
double[][] |
adjacencyMatrix()
Returns the adjacency matrix of graph g. |
void |
arrangeComponent(int v)
Arranges the component that the vertex numbered v is contained in. |
void |
arrangeVertices()
Arranges all of the vertices in the graph in a circle. |
void |
arrangeVertices(double radiusFactor,
int min,
int max,
int centerX,
int centerY)
Arranges the specified vertices in the graph in a circle. |
int |
componentOrder(int v)
Returns the integer order of the component that the vertex v is contained in. |
Point |
componentVisualCenter(int v)
Returns the graphical/visual center of the component that the vertex v is contained in. |
boolean |
existEdge(int from,
int to)
Returns true if an edge exists between the vertices numbered by from and to. |
Point |
findEdge(Point point)
Finds an edge near a point. |
int |
findVertex(Point point)
Finds a vertex near a point. |
Point |
getEdge(int from,
int to)
Returns a point containing the indices of the endpoints of the edge if it exists. |
Color |
getEdgeColor(int from,
int to)
Gets the Color of the specified Edge. |
String |
getEdgeLabel(int from,
int to)
Returns the label of the specified Edge |
double |
getEdgeWeight(int from,
int to)
Returns the weight of the specified Edge |
double |
getEdgeWeight2(int from,
int to)
Returns the second weight of the specified Edge |
int |
getGraphType()
Returns a flag for the graph type as follows: GRAPH = 0; DIGRAPH = 1; MULTIGRAPH = 2; POLYGON = 3; |
Color |
getVertexColor(int vertexNumber)
Gets the Color of the specified Vertex. |
Point |
getVertexCoord(int vertexNumber)
Returns the coordinates of the specified Vertex. |
int |
getVertexDegree(int vertex)
Return the degree of the specified vertex. |
String |
getVertexLabel(int vertexNumber)
Returns the label of the specified Vertex. |
double |
getVertexWeight(int vertexNumber)
Returns the weight of the specified Vertex. |
Rectangle |
getVisibleArea()
Gets the visible area for the graph. |
boolean |
isEdgeMarked(int from,
int to)
Returns true if the specified Edge is marked. |
boolean |
isVertexMarked(int vertexNumber)
Returns true if the specified Vertex is marked. |
void |
markAllEdges()
Sets the marked flag to true for all of the Eges in the graph. |
void |
markAllVertices()
Sets the marked flag to true for all of the Vertices in the graph. |
void |
markComponent(int v)
Marks the component that the vertex numbered v is contained in. |
void |
markEdge(int from,
int to)
Sets the marked flag to true for the specified Edge. |
void |
markVertex(int vertexNumber)
Sets the marked flag to true for the specified Vertex. |
void |
moveComponent(int v,
Point offset,
Point startingPoint)
Moves the component that the vertex numbered v is contained in. |
void |
moveVertex(int vertexNumber,
Point location)
Sets the coordinates of the specified vertex to the Point location. |
void |
numberVertices()
Sets the labels of the vertices to match their indices. |
int |
order()
Returns the total number of vertices in the graph. |
void |
removeAllMarkedVertices()
Removes all marked Vertices and their Edges from the graph. |
void |
removeAllVertices()
Removes all Vertices and their Edges from the graph. |
void |
removeComponent(int v)
Removes the component that the vertex numbered v is contained in. |
boolean |
removeEdge(int from,
int to)
Removes the specified Edge from the graph. |
boolean |
removeEdge(Point point)
Removes the specified Edge from the graph. |
void |
removeVertex(int vertexNumber)
Removes the speciefied vertex and all of its Edges from the graph. |
void |
resizeComponent(int v,
double a)
Resizes the component that the vertex numbered v is contained in. |
void |
resizeGraph(double a)
Resizes a graph |
void |
rotateComponent(int v,
double angle)
Rotates the component that the vertex numbered v is contained in by the number of degrees in angle. |
void |
setEdgeColor(int from,
int to,
Color newColor)
Sets the Color of the specified Edge. |
void |
setEdgeLabel(int from,
int to,
String label)
Sets the label of the specified Edge |
void |
setEdgeWeight(int from,
int to,
double weight)
Sets the weight of the specified Edge |
void |
setEdgeWeight2(int from,
int to,
double weight)
Sets the second weight of the specified Edge |
void |
setGraphType(int newType)
Sets the flag for graph type as follows: GRAPH = 0; DIGRAPH = 1; MULTIGRAPH = 2; POLYGON = 3; |
void |
setVertexColor(int vertexNumber,
Color newColor)
Sets the Color of the specified Vertex. |
void |
setVertexLabel(int vertexNumber,
String newLabel)
Sets the label of the specified Vertex. |
void |
setVertexWeight(int vertexNumber,
double weight)
Sets the weight of the specified Vertex |
void |
setVisibleArea(Rectangle input)
Sets the visible area for the graph. |
String |
toString()
Returns the String used in print and println method calls |
void |
unmarkAllEdges()
Sets the marked flag to false for all of the Eges in the graph. |
void |
unmarkAllVertices()
Sets the marked flag to false for all of the Vertices in the graph. |
void |
unmarkComponent(int v)
Unmarks the component that the vertex numbered v is contained in. |
void |
unmarkEdge(int from,
int to)
Sets the marked flag to false for the specified Edge. |
void |
unmarkVertex(int vertexNumber)
Sets the marked flag to false for the specified Vertex. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int GRAPH
public static final int DIGRAPH
public static final int MULTIGRAPH
public static final int POLYGON
Constructor Detail |
public JavaGraph()
public JavaGraph(JavaGraph source)
source
- the graph to clonepublic JavaGraph(int v, JavaGraph g1)
v
- number of a vertex within the componentg1
- graph that the component is inpublic JavaGraph(JavaGraph g1, JavaGraph g2)
g1
- first graphg2
- second graphMethod Detail |
public void addComponent(JavaGraph g)
g
- a graphpublic int order()
public int getVertexDegree(int vertex)
vertex
- the vertex number
public int findVertex(Point point)
point
- the point to search near
public Point findEdge(Point point)
point
- the point to search near
public Point getEdge(int from, int to)
from
- to
-
public void unmarkAllVertices()
public void markAllVertices()
public void unmarkAllEdges()
public void markAllEdges()
public void markVertex(int vertexNumber)
vertexNumber
- public void unmarkVertex(int vertexNumber)
vertexNumber
- public void markEdge(int from, int to)
from
- to
- public void unmarkEdge(int from, int to)
from
- to
- public boolean isVertexMarked(int vertexNumber)
vertexNumber
- public boolean isEdgeMarked(int from, int to)
from
- to
- public String getVertexLabel(int vertexNumber)
vertexNumber
- public void setVertexLabel(int vertexNumber, String newLabel)
vertexNumber
- newLabel
- public void setVertexColor(int vertexNumber, Color newColor)
vertexNumber
- newColor
- public Color getVertexColor(int vertexNumber)
vertexNumber
- public void setEdgeColor(int from, int to, Color newColor)
from
- to
- newColor
- public Color getEdgeColor(int from, int to)
from
- to
- public Point getVertexCoord(int vertexNumber)
vertexNumber
- public double getVertexWeight(int vertexNumber)
vertexNumber
- public void setVertexWeight(int vertexNumber, double weight)
public String getEdgeLabel(int from, int to)
public void setEdgeLabel(int from, int to, String label)
public double getEdgeWeight2(int from, int to)
public double getEdgeWeight(int from, int to)
public void setEdgeWeight2(int from, int to, double weight)
public void setEdgeWeight(int from, int to, double weight)
public String toString()
toString
in class Object
public void addVertex()
public void moveVertex(int vertexNumber, Point location)
public void addVertex(Point location)
public void removeVertex(int vertexNumber)
public void numberVertices()
public void removeAllVertices()
public void removeAllMarkedVertices()
public void addEdge(int from, int to)
public void addEdge(double weight, int from, int to)
public boolean removeEdge(int from, int to)
public boolean removeEdge(Point point)
public boolean existEdge(int from, int to)
public int getGraphType()
public void setGraphType(int newType)
newType
- public void setVisibleArea(Rectangle input)
public Rectangle getVisibleArea()
public void arrangeVertices()
public void arrangeVertices(double radiusFactor, int min, int max, int centerX, int centerY)
radiusFactor
- min
- max
- centerX
- centerY
- public void resizeGraph(double a)
public double[][] adjacencyMatrix()
public void unmarkComponent(int v)
public void markComponent(int v)
public void removeComponent(int v)
public void moveComponent(int v, Point offset, Point startingPoint)
public void arrangeComponent(int v)
public Point componentVisualCenter(int v)
public int componentOrder(int v)
public void resizeComponent(int v, double a)
public void rotateComponent(int v, double angle)
|
Jedit 4.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |