|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectscg.ac.ni.pmf.newgraph.graphdata.GraphData
public final class GraphData
The class holds information about a graph. It contains data about:
The structure of the graph are the sets of vertices and edges. Each vertex has ID. ID is the numerical identificator used internally in the program.
The current selection are the vertices and edges selected in the graph edit pane. Each selection has a primary selected vertex and edge, which are the first selected vertex and edge in the selection. The graph edit pane also has a graphical representation of the graph, with each vertex having its X and Y coordinate. Each graph also has a name, which is the name of the file where the graph is stored.
The class also provides three essential tasks with the graph data. It:
.
The class can not change the graph structure. To change the graph structure,
use Graph
.
Graph
,
EdgeData
,
VertexData
,
Serialized FormMethod Summary | |
---|---|
int[][] |
adjacencyMatrix()
Creates the adjacency matrix of the graph. |
java.lang.Object |
clone()
Clones the object. |
int |
degree(int id)
Retrieves the degree of the vertex. |
int[][] |
distances()
Retrieves the array of distances between vertices. |
java.util.Enumeration |
edges()
Retrieves an enumeration on all the edges of the graph. |
boolean |
equals(java.lang.Object o)
Indicates whether some other object is "equal to" this one. |
java.lang.String |
getAbsolutePath()
Retrieves the file absolute path. |
java.util.Set |
getAllWeights()
Retrieves a set of all the weights defined in the graph. |
java.util.Set |
getComponent(int id)
Retrieves the set of all the vertices that are connected to the given vertex. |
java.util.Set |
getComponentO(int id)
Retrieves the set of all the vertices that are connected to the given vertex. |
EdgeData |
getEdge(VertexData va,
VertexData vb)
Retrieves the edge with the given vertices as endpoints, or null ,
if no such edge exists. |
java.lang.String |
getFileName()
Retrieves the name of the file. |
int |
getIndex(EdgeData edgeData)
Retrieves the index of the edge data in the edge enumeration. |
int |
getIndex(VertexData vertexData)
Retrieves the index of the vertex data in the adjacency matrix, and in the vertex enumeration. |
int |
getNumberOfEdges()
Retrieves the number of edges. |
int |
getOrder()
Retrieves the order of the graph (the number of vertices). |
EdgeData |
getPrimarySelectedEdge()
Retrieves the primary selected edge. |
VertexData |
getPrimarySelectedVertex()
Retrieves the primary selected vertex. |
int |
getSelectedEdgesNo()
Retrieves the number of selected edges. |
int |
getSelectedVerticesNo()
Retrieves the number of selected vertices. |
VertexData |
getVertex(int id)
Retrieves the vertex with the given ID, or null , if such vertex
does not exist. |
double |
getWeight(EdgeData e,
scg.ac.ni.pmf.newgraph.graphdata.WeightEdgeDouble weight)
Retrieves the weight double value of the edge. |
int |
getWeight(EdgeData e,
scg.ac.ni.pmf.newgraph.graphdata.WeightEdgeInt weight)
Retrieves the weight integer value of the edge. |
java.lang.String |
getWeight(EdgeData e,
scg.ac.ni.pmf.newgraph.graphdata.WeightEdgeString weight)
Retrieves the weight string value of the edge. |
double |
getWeight(VertexData v,
scg.ac.ni.pmf.newgraph.graphdata.WeightVertexDouble weight)
Retrieves the weight double value of the vertex. |
int |
getWeight(VertexData v,
scg.ac.ni.pmf.newgraph.graphdata.WeightVertexInt weight)
Retrieves the weight integer value of the vertex. |
java.lang.String |
getWeight(VertexData v,
scg.ac.ni.pmf.newgraph.graphdata.WeightVertexString weight)
Retrieves the weight string value of the vertex. |
java.util.Map |
getWeights(EdgeData e)
Retrieves a map of weights of the edge into weight values. |
java.util.Map |
getWeights(VertexData v)
Retrieves a map of weights of the vertex into weight values. |
int |
hashCode()
Generates the hash code of the object. |
boolean |
hasWeight(EdgeData e,
scg.ac.ni.pmf.newgraph.graphdata.Weight weight)
Indicates whether there exist a weight value of the edge. |
boolean |
hasWeight(VertexData v,
scg.ac.ni.pmf.newgraph.graphdata.Weight weight)
Indicates whether there exist a weight value of the vertex. |
boolean |
isAdjanced(int idA,
int idB)
Retrieves are the vertices adjanced. |
boolean |
isAdjanced(VertexData va,
VertexData vb)
Retrieves are the vertices adjanced. |
boolean |
isDirty()
Retrieves was the graph changed after the last save. |
boolean |
isPrimarySelected(Edge edge)
Retrieves is the edge primary selected. |
boolean |
isPrimarySelected(EdgeData edge)
Retrieves is the edge primary selected. |
boolean |
isPrimarySelected(Element element)
Retrieves is the given element primary selected. |
boolean |
isPrimarySelected(ElementData element)
Retrieves is the given element primary selected. |
boolean |
isPrimarySelected(int id)
Indicates whether the vertex with the given ID is primary selected. |
boolean |
isPrimarySelected(int idA,
int idB)
Retrieves is the edge with the given endpoints primary selected. |
boolean |
isPrimarySelected(Vertex vertex)
Indicates whether the vertex is primary selected. |
boolean |
isPrimarySelected(VertexData vertex)
Indicates whether the vertex is primary selected. |
boolean |
isSelected(EdgeData e)
Retrieves is the edge selected. |
boolean |
isSelected(int id)
Retrieves is the vertex selected. |
boolean |
isSelected(int idA,
int idB)
Retrieves is the specified edge selected. |
boolean |
isSelected(VertexData v)
Retrieves is the vertex selected. |
boolean |
isSelected(VertexData va,
VertexData vb)
Retrieves is the edge selected. |
boolean |
isSelectionEmpty()
Retrieves is the selection empty. |
int[][] |
laplacianMatrix()
Creates the Laplacian matrix of the graph. |
java.util.Enumeration |
neighbors(int id)
Retrieves an enumeration of neighbors of the specified vertex. |
boolean |
sameStructure(GraphData data)
Checks if the given graph data has the same structure as the graph data. |
java.util.Enumeration |
selectedEdges()
Retrieves an enumeration on all the selected edges. |
java.util.Enumeration |
selectedVertices()
Retrieves an enumeration on all the selected vertices. |
java.lang.String |
toString()
Retrieves the string representation of the graph data. |
java.util.Enumeration |
vertices()
Retrieves an enumeration on all the vertices of the graph. |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public java.util.Enumeration vertices()
VertexData
.public int getOrder()
public VertexData getVertex(int id)
null
, if such vertex
does not exist.
id
- The ID of the vertex.
public int getIndex(VertexData vertexData)
vertexData
- The vertex data.
public java.util.Enumeration edges()
EdgeData
.public int getNumberOfEdges()
public EdgeData getEdge(VertexData va, VertexData vb)
null
,
if no such edge exists.
va
- The first vertex.vb
- The second vertex.
public int getIndex(EdgeData edgeData)
edgeData
- The edge data.
public boolean isAdjanced(int idA, int idB)
idA
- The ID of one of the endpoints.idB
- The ID of the other endpoint.
public boolean isAdjanced(VertexData va, VertexData vb)
va
- The first vertex.vb
- The second vertex.
public java.util.Enumeration selectedVertices()
VertexData
.public boolean isSelected(int id)
id
- The vertex.
public boolean isSelected(VertexData v)
v
- The vertex data.
public int getSelectedVerticesNo()
public java.util.Enumeration selectedEdges()
EdgeData
.public boolean isSelected(int idA, int idB)
idA
- The ID of one of the endpoints.idB
- The ID of the other endpoint.
public boolean isSelected(EdgeData e)
e
- The edge data.
public boolean isSelected(VertexData va, VertexData vb)
va
- One of the edge endpoints.vb
- The other edge endpoint.
public int getSelectedEdgesNo()
public boolean isSelectionEmpty()
public VertexData getPrimarySelectedVertex()
public boolean isPrimarySelected(int id)
id
- The ID of the vertex.
public boolean isPrimarySelected(VertexData vertex)
vertex
- The vertex data.
public boolean isPrimarySelected(Vertex vertex)
vertex
- The vertex.
public EdgeData getPrimarySelectedEdge()
public boolean isPrimarySelected(int idA, int idB)
idA
- The ID of one of the endpoints.idB
- The ID of the other endpoint.
public boolean isPrimarySelected(EdgeData edge)
edge
- The edge data.public boolean isPrimarySelected(Edge edge)
edge
- The edge.public boolean isPrimarySelected(ElementData element)
element
- The element data.
public boolean isPrimarySelected(Element element)
element
- The element.
public java.lang.String getFileName()
public java.lang.String getAbsolutePath()
public boolean isDirty()
public int degree(int id)
id
- The ID of the vertex.
public java.util.Enumeration neighbors(int id)
id
- The ID of the vertex.
VertexData
.public int[][] adjacencyMatrix()
public int[][] laplacianMatrix()
public int[][] distances()
public java.util.Set getComponent(int id)
id
- The ID of the vertex.
VertexData
.public java.util.Set getComponentO(int id)
id
- The ID of the vertex.
Vertex
.public java.lang.Object clone()
clone
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
Object.equals(Object)
public boolean sameStructure(GraphData data)
data
- The graph data.
public java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
public int hashCode()
hashCode
in class java.lang.Object
Object.hashCode()
public int getWeight(VertexData v, scg.ac.ni.pmf.newgraph.graphdata.WeightVertexInt weight)
v
- The vertex.weight
- The weight.public double getWeight(VertexData v, scg.ac.ni.pmf.newgraph.graphdata.WeightVertexDouble weight)
v
- The vertex.weight
- The weight.public java.lang.String getWeight(VertexData v, scg.ac.ni.pmf.newgraph.graphdata.WeightVertexString weight)
v
- The vertex.weight
- The weight.public boolean hasWeight(VertexData v, scg.ac.ni.pmf.newgraph.graphdata.Weight weight)
v
- The vertex.weight
- The weight.public java.util.Map getWeights(VertexData v)
v
- The vertex.public int getWeight(EdgeData e, scg.ac.ni.pmf.newgraph.graphdata.WeightEdgeInt weight)
e
- The edge.weight
- The weight.public double getWeight(EdgeData e, scg.ac.ni.pmf.newgraph.graphdata.WeightEdgeDouble weight)
e
- The edge.weight
- The weight.public java.lang.String getWeight(EdgeData e, scg.ac.ni.pmf.newgraph.graphdata.WeightEdgeString weight)
e
- The edge.weight
- The weight.public boolean hasWeight(EdgeData e, scg.ac.ni.pmf.newgraph.graphdata.Weight weight)
e
- The edge.weight
- The weight.public java.util.Map getWeights(EdgeData e)
e
- The edge.public java.util.Set getAllWeights()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |