shared
Class Node

java.lang.Object
  |
  +--shared.GraphObject
        |
        +--shared.Node

public class Node
extends GraphObject

Node representation object for internal use in the Graph class.

See Also:
Graph

Field Summary
 int[] adj_length
          The lengths of all Edges that have this Node as their source Node.
 Edge[] first_adj_edge
          The Edge chain that represents the first edge connecting to this Node.
 int index_number
          The index number of this Node object.
 Edge[] last_adj_edge
          The Edge chain that represents the last edge connecting to this Node.
 Graph owner
          The Graph class that owns this Node object.
 
Fields inherited from class shared.GraphObject
data, id, obj_list_pred, obj_list_succ
 
Constructor Summary
Node(java.lang.Object inf)
          Constructor.
 
Method Summary
 java.util.LinkedList adj_edges()
          Return a list of all Edges starting from this Node.
 java.util.LinkedList adj_nodes()
          Returns a list of the Node targets of all Edges whose source is this Node.
 void append_adj_edge(Edge e, int i, int chain_e)
          Appends the given Edge to the adjacency list of this Node.
 void copy(Node original)
          Copies the given Node object into this Node object.
 int degree()
          Returns the number of Edges connected to this Node.
 void del_adj_edge(Edge e, int i, int chain_e)
          Deletes the specified Edge.
 Edge first_adj_edge()
          Returns the first Edge in the adjacency list of this Node.
 Edge First_Adj_Edge(int i)
          Returns the first adjacent Edge at the indicated position in the adjacency list.
 Edge first_in_edge()
          Returns the first Edge with this Node as its target.
 java.lang.Object getData()
          Returns the data stored in this Node object.
 Graph graph_of()
          Returns the Graph that contains this Node.
 java.util.LinkedList in_edges()
          Returns a list of all Edges ending at this Node.
 int indeg()
          Returns the number of Edges leading into this Node.
 int index()
          Returns the index number of this Node object.
 void insert_adj_edge(Edge e, Edge e1, int i, int chain_e, int dir)
          Inserts an Edge object into the chain of Edges.
 Edge last_adj_edge()
          Returns the last Edge in the adjacency list of this Node.
 Edge Last_Adj_Edge(int i)
          Returns the last adjacent Edge at the indicated position in the adjacency list.
 Edge last_in_edge()
          Returns the last Edge with this Node as its target.
 java.util.LinkedList out_edges()
          Return a list of all Edges starting from this Node if the owning Graph is directed, otherwise an empty list is returned.
 int outdeg()
          Returns the number of Edges adjacent to Node.
 void print_node(java.io.Writer out)
          Displays this Node object.
 void setIndexNumber(int new_number)
          Sets the index number for this Node object.
 java.lang.String toString()
          Converts this Node object to a String representation.
 
Methods inherited from class shared.GraphObject
set_id
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

owner

public Graph owner
The Graph class that owns this Node object.

first_adj_edge

public Edge[] first_adj_edge
The Edge chain that represents the first edge connecting to this Node.

last_adj_edge

public Edge[] last_adj_edge
The Edge chain that represents the last edge connecting to this Node.

adj_length

public int[] adj_length
The lengths of all Edges that have this Node as their source Node.

index_number

public int index_number
The index number of this Node object.
Constructor Detail

Node

public Node(java.lang.Object inf)
Constructor.
Parameters:
inf - The data to be stored in this Node object.
Method Detail

append_adj_edge

public void append_adj_edge(Edge e,
                            int i,
                            int chain_e)
Appends the given Edge to the adjacency list of this Node.
Parameters:
e - The Edge to be added.
i - Position in the adjancency list.
chain_e - The position in the chain of Edges making up this edge representation.

insert_adj_edge

public void insert_adj_edge(Edge e,
                            Edge e1,
                            int i,
                            int chain_e,
                            int dir)
Inserts an Edge object into the chain of Edges.
Parameters:
e - The Edge to be inserted.
e1 - The Edge in the chain of Edge objects that will be connected to the Edge being inserted.
i - The position in the adjacency list indicating the chain of Edges to be added to.
chain_e - The position in the chain of Edges making up this edge representation.
dir - If dir is 0, the Edge e is inserted after e1 in the chain of Edges, otherwise e is inserted before e1.

del_adj_edge

public void del_adj_edge(Edge e,
                         int i,
                         int chain_e)
Deletes the specified Edge.
Parameters:
e - The Edge to be deleted.
i - The Edge chain containing the Edge to be deleted.
chain_e - The position in the chain of Edges making up this edge representation.

getData

public java.lang.Object getData()
Returns the data stored in this Node object.
Returns:
The data stored in this Node object.

graph_of

public Graph graph_of()
Returns the Graph that contains this Node.
Returns:
The Graph that contains this Node.

index

public int index()
Returns the index number of this Node object.
Overrides:
index in class GraphObject
Returns:
The index number of this Node object.

outdeg

public int outdeg()
Returns the number of Edges adjacent to Node.
Returns:
The number of Edges in the adjacency list of this Node.

indeg

public int indeg()
Returns the number of Edges leading into this Node.
Returns:
The number of Edges leading into this Node.

degree

public int degree()
Returns the number of Edges connected to this Node.
Returns:
The number of Edges connected to this Node.

copy

public void copy(Node original)
Copies the given Node object into this Node object.
Parameters:
original - The Node object to be copied.

First_Adj_Edge

public Edge First_Adj_Edge(int i)
Returns the first adjacent Edge at the indicated position in the adjacency list.
Parameters:
i - The position of this Edge.
Returns:
The first adjacent Edge at the indicated position in the adjacency list.

Last_Adj_Edge

public Edge Last_Adj_Edge(int i)
Returns the last adjacent Edge at the indicated position in the adjacency list.
Parameters:
i - The position of this Edge.
Returns:
The last adjacent Edge at the indicated position in the adjacency list.

adj_edges

public java.util.LinkedList adj_edges()
Return a list of all Edges starting from this Node.
Returns:
A list of all Edges starting from this Node.

out_edges

public java.util.LinkedList out_edges()
Return a list of all Edges starting from this Node if the owning Graph is directed, otherwise an empty list is returned.
Returns:
A list of all Edges starting from this Node.

in_edges

public java.util.LinkedList in_edges()
Returns a list of all Edges ending at this Node.
Returns:
A list of all Edges ending at this Node.

adj_nodes

public java.util.LinkedList adj_nodes()
Returns a list of the Node targets of all Edges whose source is this Node.
Returns:
A list of the Nodes

first_adj_edge

public Edge first_adj_edge()
Returns the first Edge in the adjacency list of this Node.
Returns:
The first Edge in the adjacency list of this Node.

last_adj_edge

public Edge last_adj_edge()
Returns the last Edge in the adjacency list of this Node.
Returns:
The last Edge in the adjacency list of this Node.

first_in_edge

public Edge first_in_edge()
Returns the first Edge with this Node as its target.
Returns:
The first Edge with this Node as its target.

last_in_edge

public Edge last_in_edge()
Returns the last Edge with this Node as its target.
Returns:
The last Edge with this Node as its target.

print_node

public void print_node(java.io.Writer out)
                throws java.io.IOException
Displays this Node object.
Parameters:
out - The Writer to which this Node object will be displayed.
Throws:
java.io.IOException - if the Writer experiences an Exception.

toString

public java.lang.String toString()
Converts this Node object to a String representation.
Overrides:
toString in class java.lang.Object
Returns:
A String representation of this Node object.

setIndexNumber

public void setIndexNumber(int new_number)
Sets the index number for this Node object.
Parameters:
new_number - The new index number.