All Packages Class Hierarchy This Package Previous Next Index
Class relaaja.netlayout.VGJ.Graph
java.lang.Object
|
+----relaaja.netlayout.VGJ.Graph
- public class Graph
- extends Object
- implements Cloneable
A class for representing a graph abstractly.
Here is the source.
- Author:
- Larry Barowski
-
directed_
-
-
edges_
-
-
idHash_
-
-
lastTopId_
-
-
nodeList_
- nodeList_ holds the graph
-
Graph()
- construct empty graph
-
Graph(boolean)
- construct empty graph with direction
-
adjustGroupChildren_(Node, double, double, double, double, double, double)
-
-
children(int)
-
-
clone()
- makes a copy of the current graph
-
copy(Graph)
- Copy the properties of another graph.
-
dummysToEdgePaths()
- Convert dummy nodes to edge paths.
-
fillBackEdges_()
-
-
firstAvailable()
-
-
firstNode()
-
-
firstNodeIndex()
-
-
getEdge(int, int)
-
-
getEdgePathPoints(int, int)
- Get the path points for an edge.
-
getEdges()
-
-
getIndexFromNode(Node)
-
-
getNodeFromId(int)
-
-
getNodeFromIndex(int)
-
-
highestIndex()
-
-
insertEdge(Edge)
- Insert an edge.
-
insertEdge(int, int)
- insert an edge between two nodes
-
insertEdge(int, int, DPoint3[])
- Insert an edge with path points.
-
insertEdge(int, int, DPoint3[], String)
- Insert an edge with path points and a label.
-
insertNode()
- insert new node into graph; no initial connections
-
insertNode(boolean)
- Insert new node or dummy node into the graph.
-
insertNodeAt(int)
- insert new node into graph; into the nodelist at the index
-
isDirected()
- function to determine the graph type (directed or undirected)
-
killGroup(Node)
-
-
markGroupChildren_(Node, boolean)
-
-
nextNode(Node)
-
-
nextNodeIndex(int)
-
-
nodeFromIndex(int)
-
-
numberOfNodes()
-
-
pack()
- Re-index so the indexes go from 0 to number of
nodes - 1.
-
parents(int)
-
-
removeEdge(Edge)
-
-
removeEdge(int, int)
- remove the connection from n1 to n2 but leave the nodes in place
-
removeEdgePaths()
- Eliminate edge paths.
-
removeFalseEdges_()
-
-
removeGroups()
-
-
removeNode(int)
- remove the node from the graph(also removes the edges connected to it)
-
removeNode(Node)
- remove the node from the graph
-
setDirected(boolean)
-
-
setNodeGroup(Node, Node)
-
-
validateIds()
-
nodeList_
private NodeList nodeList_
- nodeList_ holds the graph
idHash_
private Hashtable idHash_
directed_
private boolean directed_
lastTopId_
private int lastTopId_
edges_
private Hashtable edges_
Graph
public Graph()
- construct empty graph
Graph
public Graph(boolean yesorno)
- construct empty graph with direction
validateIds
private void validateIds()
isDirected
public boolean isDirected()
- function to determine the graph type (directed or undirected)
- Returns:
- boolean value
clone
public Object clone()
- makes a copy of the current graph
- Returns:
- copy of current graph
- Overrides:
- clone in class Object
copy
public void copy(Graph newgraph)
- Copy the properties of another graph. This assumes the other graph
will be subsequently deleted - otherwise use copy(clone(graph_to_copy)).
insertNode
public int insertNode()
- insert new node into graph; no initial connections
- Returns:
- index of the new node
insertNode
public int insertNode(boolean dummy)
- Insert new node or dummy node into the graph.
- Returns:
- index of the new node
getNodeFromIndex
public Node getNodeFromIndex(int index)
- Returns:
- s the node at the 'index'
getNodeFromId
public Node getNodeFromId(int id)
insertNodeAt
public void insertNodeAt(int index) throws IOException
- insert new node into graph; into the nodelist at the index
- Parameters:
- integer - index to place node
- Returns:
- nodeList_ with the new node
removeNode
public void removeNode(int n)
- remove the node from the graph(also removes the edges connected to it)
removeNode
public void removeNode(Node nin)
- remove the node from the graph
insertEdge
public void insertEdge(int n1,
int n2)
- insert an edge between two nodes
- Parameters:
- two - integers node indexes
insertEdge
public void insertEdge(int n1,
int n2,
DPoint3 points[])
- Insert an edge with path points.
insertEdge
public void insertEdge(int n1,
int n2,
DPoint3 points[],
String label)
- Insert an edge with path points and a label.
insertEdge
public void insertEdge(Edge edge)
- Insert an edge.
getEdgePathPoints
public DPoint3[] getEdgePathPoints(int n1,
int n2)
- Get the path points for an edge.
getEdge
public Edge getEdge(int n1,
int n2)
removeEdge
public void removeEdge(int n1,
int n2)
- remove the connection from n1 to n2 but leave the nodes in place
- Parameters:
- integer - index of each node on the edge
removeEdge
public void removeEdge(Edge edge)
parents
public Set parents(int n)
- Parameters:
- node - to get parents of
- Returns:
- s a set of all the nodes leading to n
children
public Set children(int n)
- Returns:
- s a set of all the nodes n leads to
numberOfNodes
public int numberOfNodes()
- Returns:
- s the number of nodes in the graph
firstNode
public Node firstNode()
- Returns:
- s the first node of the graph
nextNode
public Node nextNode(Node node)
- Returns:
- s the next node after node
getIndexFromNode
public int getIndexFromNode(Node node)
- Returns:
- s the integer value of the index for the node
firstNodeIndex
public int firstNodeIndex()
- Returns:
- s the index of the first node in graph.nodeList
nextNodeIndex
public int nextNodeIndex(int index)
- Returns:
- s the index of the next node after the current index
firstAvailable
public int firstAvailable()
highestIndex
public int highestIndex()
setDirected
public void setDirected(boolean directed)
fillBackEdges_
private void fillBackEdges_()
removeFalseEdges_
private void removeFalseEdges_()
pack
public void pack()
- Re-index so the indexes go from 0 to number of
nodes - 1.
removeEdgePaths
public void removeEdgePaths()
- Eliminate edge paths.
dummysToEdgePaths
public void dummysToEdgePaths()
- Convert dummy nodes to edge paths.
getEdges
public Enumeration getEdges()
nodeFromIndex
public Node nodeFromIndex(int index)
adjustGroupChildren_
private void adjustGroupChildren_(Node node,
double dx,
double dy,
double dz,
double rw,
double rh,
double rd)
markGroupChildren_
private void markGroupChildren_(Node node,
boolean state)
killGroup
public void killGroup(Node node)
setNodeGroup
public void setNodeGroup(Node node,
Node groupnode)
removeGroups
public void removeGroups()
All Packages Class Hierarchy This Package Previous Next Index