| prefuse.data.tuple.CompositeTupleSet prefuse.data.Graph
All known Subclasses: prefuse.data.Tree, prefuse.visual.VisualGraph,
Graph | public class Graph extends CompositeTupleSet (Code) | | A Graph models a network of nodes connected by a collection of edges.
Both nodes and edges can have any number of associated data fields.
Additionally, edges are either directed or undirected, indicating a
possible directionality of the connection. Each edge has both a source
node and a target node, for a directed edge this indicates the
directionality, for an undirected edge this is just an artifact
of the order in which the nodes were specified when added to the graph.
Both nodes and edges are represented by backing data
Table instances storing the data attributes. For edges, this table must
also contain a source node field and a target node field. The default
column name for these fields are
Graph.DEFAULT_SOURCE_KEY and
Graph.DEFAULT_TARGET_KEY , but these can be configured by the graph
constructor. These columns should be integer valued, and contain
either the row number for a corresponding node in the node table,
or another unique identifier for a node. In this second case, the
unique identifier must be included as a data field in the node
table. This name of this column can be configured using the appropriate
graph constructor. The default column name for this field is
Graph.DEFAULT_NODE_KEY , which by default evaluates to null,
indicating that no special node key should be used, just the direct
node table row numbers. Though the source, target, and node key
values completely specify the graph linkage structure, to make
graph operations more efficient an additional table is maintained
internally by the Graph class, storing node indegree and outdegree
counts and adjacency lists for the inlinks and outlinks for all nodes.
Graph nodes and edges can be accessed by application code by either
using the row numbers of the node and edge tables, which provide unique ids
for each, or using the
prefuse.data.Node and
prefuse.data.Edge classes --
prefuse.data.Tuple instances that provide
object-oriented access to both node or edge data values and the
backing graph structure. Node and Edge tuples are maintained by
special TupleManager instances contained within this Graph. By default, they
are not accessible from the backing node or edge tables directly. The reason
for this is that these tables might be used in multiple graphs
simultaneously. For example, a node data table could be used in a number of
different graphs, exploring different possible linkages between those node.
In short, use this Graph instance to request iterators over Node or
Edge tuples, not the backing data tables.
All Graph instances also support an internally generated
spanning tree, provided by the
Graph.getSpanningTree() or
Graph.getSpanningTree(Node) methods. This is particularly
useful in visualization contexts that use an underlying tree structure
to compute a graph layout.
author: jeffrey heer |
Constructor Summary | |
public | Graph() Creates a new, empty undirected Graph. | public | Graph(boolean directed) Creates a new, empty Graph. | public | Graph(Table nodes, boolean directed) Create a new Graph using the provided table of node data and
an empty set of edges. | public | Graph(Table nodes, boolean directed, String nodeKey, String sourceKey, String targetKey) Create a new Graph using the provided table of node data and
an empty set of edges.
Parameters: nodes - the backing table to use for node data.Node instances of this graph will get their data from this table. Parameters: directed - true for directed edges, false for undirected Parameters: nodeKey - data field used to uniquely identify a node. | public | Graph(Table nodes, Table edges, boolean directed) Create a new Graph, using node table row numbers to uniquely
identify nodes in the edge table's source and target fields. | public | Graph(Table nodes, Table edges, boolean directed, String sourceKey, String targetKey) Create a new Graph, using node table row numbers to uniquely
identify nodes in the edge table's source and target fields. | public | Graph(Table nodes, Table edges, boolean directed, String nodeKey, String sourceKey, String targetKey) Create a new Graph.
Parameters: nodes - the backing table to use for node data.Node instances of this graph will get their data from this table. Parameters: edges - the backing table to use for edge data.Edge instances of this graph will get their data from this table. Parameters: directed - true for directed edges, false for undirected Parameters: nodeKey - data field used to uniquely identify a node. |
Method Summary | |
public int | addEdge(int s, int t) Add an edge to the graph. | public Edge | addEdge(Node s, Node t) Add an edge to the graph. | public void | addGraphModelListener(GraphListener listnr) Add a listener to be notified of changes to the graph. | protected void | addLink(String field, int len, int n, int e) | public Node | addNode() Add a new node to the graph. | public int | addNodeRow() Add row to the node table, thereby adding a node to the graph. | public void | clear() Clear this graph, removing all nodes and edges. | protected void | clearEdges() Internal method for clearing the edge table, removing all edges. | public void | clearSpanningTree() Clear the internally stored spanning tree. | protected Table | createLinkTable() Instantiate and return the link table. | public void | dispose() Dispose of this graph. | protected boolean | edgeCheck(Edge e, boolean throwException) Internal method for checking the validity of an edge. | public IntIterator | edgeRows() Get an iterator over all edge ids (edge table row numbers). | public IntIterator | edgeRows(int node) Get an iterator over all edge ids for edges incident on the given node. | public IntIterator | edgeRows(int node, int direction) Get an iterator edge ids for edges incident on the given node.
Parameters: node - a node id (node table row number) Parameters: direction - the directionality of the edges to include. | public Iterator | edges() Get an iterator over all edges in the graph. | public Iterator | edges(Node node) Get an iterator over all Edges connected to the given Node in the graph. | protected void | fireGraphEvent(Table t, int first, int last, int col, int type) | public int | getAdjacentNode(int edge, int node) Given an edge id and an incident node id, return the node id for
the other node connected to the edge.
Parameters: edge - an edge id (edge table row number) Parameters: node - a node id (node table row number). | public Node | getAdjacentNode(Edge e, Node n) Given an Edge and an incident Node, return the other Node
connected to the edge.
Parameters: e - an Edge instance Parameters: n - a Node instance. | public int | getDegree(int node) Get the degree of a node, the number of edges for which a node
is either the source or the target. | public int | getDegree(Node n) Get the degree of a node, the number of edges for which a node
is either the source or the target. | public Edge | getEdge(int e) Get the Edge tuple instance corresponding to an edge id. | public int | getEdge(int source, int target) Returns an edge from the source node to the target node. | public Edge | getEdge(Node source, Node target) Get an Edge with given source and target Nodes. | public int | getEdgeCount() Get the number of edges in this graph. | public String | getEdgeSourceField() Get the data field used to denote the source node in an edge table. | public Table | getEdgeTable() Get the backing edge table. | public String | getEdgeTargetField() Get the data field used to denote the target node in an edge table. | public TupleSet | getEdges() Get the collection of edges as a TupleSet. | public int | getInDegree(int node) Get the in-degree of a node, the number of edges for which the node
is the target. | public int | getInDegree(Node n) Get the in-degree of a node, the number of edges for which the node
is the target. | public long | getKey(int node) Given a node id (a row number in the node table), get the value of
the node key field. | public Node | getNode(int n) Get the Node tuple instance corresponding to a node id. | public int | getNodeCount() Get the number of nodes in this graph. | public Node | getNodeFromKey(long key) Get the Node tuple corresponding to the input node key field value. | public int | getNodeIndex(long key) Given a value of the node key field, get the node id (the row number
in the node table). | public String | getNodeKeyField() | public Table | getNodeTable() Get the backing node table. | public TupleSet | getNodes() Get the collection of nodes as a TupleSet. | public int | getOutDegree(int node) Get the out-degree of a node, the number of edges for which the node
is the source. | public int | getOutDegree(Node n) Get the out-degree of a node, the number of edges for which the node
is the source. | public int | getSourceNode(int edge) Get the source node id (node table row number) for the given edge
id (edge table row number). | public Node | getSourceNode(Edge e) Get the source Node for the given Edge instance. | public Tree | getSpanningTree() Return the current spanning tree over this graph. | public Tree | getSpanningTree(Node root) Returns a spanning tree rooted at the specified node. | public int | getTargetNode(int edge) Get the target node id (node table row number) for the given edge
id (edge table row number). | public Node | getTargetNode(Edge e) Get the target Node for the given Edge instance. | public IntIterator | inEdgeRows(int node) Get an iterator over all edges that have the given node as a target. | public Iterator | inEdges(Node node) Get an iterator over all in-linking edges to the given Node. | public Iterator | inNeighbors(Node n) Get an iterator over all in-linking neighbor nodes for the given Node. | protected void | init(Table nodes, Table edges, boolean directed, String nodeKey, String sourceKey, String targetKey) Initialize this Graph instance. | protected void | initLinkTable() Initialize the link table, which holds adjacency lists for this graph. | public boolean | isDirected() Indicates if the edges of this graph are directed or undirected. | public Iterator | neighbors(Node n) Get an iterator over all neighbor nodes for the given Node in the graph. | protected boolean | nodeCheck(Node n, boolean throwException) Internal method for checking the validity of a node. | public IntIterator | nodeRows() Get an iterator over all node ids (node table row numbers). | public Iterator | nodes() Get an iterator over all nodes in the graph. | public IntIterator | outEdgeRows(int node) Get an iterator over all edges that have the given node as a source. | public Iterator | outEdges(Node node) Get an iterator over all out-linking edges from the given Node. | public Iterator | outNeighbors(Node n) Get an iterator over all out-linking neighbor nodes for the given Node. | protected boolean | remLink(String field, int len, int n, int e) | public void | removeAllGraphModelListeners() | public boolean | removeEdge(int edge) Remove an edge from the graph. | public boolean | removeEdge(Edge e) Remove an edge from the graph. | public void | removeGraphModelListener(GraphListener listnr) Remove a listener from this graph. | public boolean | removeNode(int node) Remove a node from the graph, also removing all incident edges. | public boolean | removeNode(Node n) Remove a node from the graph, also removing all incident edges. | public boolean | removeTuple(Tuple t) If the given tuple is a Node or Edge in this graph, remove it. | public void | setEdgeTable(Table edges) Updates this graph to use a different edge structure for the same nodes. | public void | setTupleManagers(TupleManager ntm, TupleManager etm) Set the tuple managers used to manage the Node and Edge tuples of this
Graph. | public Iterator | tuples(Predicate filter) Get a filtered iterator over the edges and nodes of this graph. | public Iterator | tuples() Get an iterator over all the edges and nodes of this graph. | protected void | updateDegrees(int e, int incr) Internal method for updating the linkage of this graph. | protected void | updateDegrees(int e, int s, int t, int incr) Internal method for updating the linkage of this graph. | protected void | updateNodeData(int r, boolean added) |
DEFAULT_NODE_KEY | final public static String DEFAULT_NODE_KEY(Code) | | Default data field used to uniquely identify a node
|
DEFAULT_SOURCE_KEY | final public static String DEFAULT_SOURCE_KEY(Code) | | Default data field used to denote the source node in an edge table
|
DEFAULT_TARGET_KEY | final public static String DEFAULT_TARGET_KEY(Code) | | Default data field used to denote the target node in an edge table
|
EDGES | final public static String EDGES(Code) | | Data group name to identify the edges of this graph
|
INDEGREE | final protected static String INDEGREE(Code) | | In-degree data field for the links table
|
INEDGES | final public static int INEDGES(Code) | | Indicates incoming edges (inlinks)
|
INLINKS | final protected static String INLINKS(Code) | | In-links adjacency list data field for the links table
|
LINKS_SCHEMA | final protected static Schema LINKS_SCHEMA(Code) | | Schema used for the internal graph linkage table
|
NODES | final public static String NODES(Code) | | Data group name to identify the nodes of this graph
|
OUTDEGREE | final protected static String OUTDEGREE(Code) | | Out-degree data field for the links table
|
OUTEDGES | final public static int OUTEDGES(Code) | | Indicates outgoing edges (outlinks)
|
OUTLINKS | final protected static String OUTLINKS(Code) | | Out-links adjacency list data field for the links table
|
UNDIRECTED | final public static int UNDIRECTED(Code) | | Indicates all edges, regardless of direction
|
m_directed | protected boolean m_directed(Code) | | Indicates if this graph is directed or undirected
|
m_edgeTuples | protected TupleManager m_edgeTuples(Code) | | TupleManager for managing Edge tuple instances
|
m_links | protected Table m_links(Code) | | Table containing the adjacency lists for the graph
|
m_longKey | protected boolean m_longKey(Code) | | Indicates if the key values are of type long
|
m_nidx | protected Index m_nidx(Code) | | Reference to an index over the node key field
|
m_nkey | protected String m_nkey(Code) | | The node key field (for the Node table)
|
m_nodeTuples | protected TupleManager m_nodeTuples(Code) | | TupleManager for managing Node tuple instances
|
m_skey | protected String m_skey(Code) | | The source node key field (for the Edge table)
|
m_tkey | protected String m_tkey(Code) | | The target node key field (for the Edge table)
|
Graph | public Graph()(Code) | | Creates a new, empty undirected Graph.
|
Graph | public Graph(boolean directed)(Code) | | Creates a new, empty Graph.
Parameters: directed - true for directed edges, false for undirected |
Graph | public Graph(Table nodes, boolean directed)(Code) | | Create a new Graph using the provided table of node data and
an empty set of edges.
Parameters: nodes - the backing table to use for node data.Node instances of this graph will get their data from this table. Parameters: directed - true for directed edges, false for undirected |
Graph | public Graph(Table nodes, boolean directed, String nodeKey, String sourceKey, String targetKey)(Code) | | Create a new Graph using the provided table of node data and
an empty set of edges.
Parameters: nodes - the backing table to use for node data.Node instances of this graph will get their data from this table. Parameters: directed - true for directed edges, false for undirected Parameters: nodeKey - data field used to uniquely identify a node. If thisfield is null, the node table row numbers will be used Parameters: sourceKey - data field used to denote the source node in an edgetable Parameters: targetKey - data field used to denote the target node in an edgetable |
Graph | public Graph(Table nodes, Table edges, boolean directed)(Code) | | Create a new Graph, using node table row numbers to uniquely
identify nodes in the edge table's source and target fields.
Parameters: nodes - the backing table to use for node data.Node instances of this graph will get their data from this table. Parameters: edges - the backing table to use for edge data.Edge instances of this graph will get their data from this table. Parameters: directed - true for directed edges, false for undirected |
Graph | public Graph(Table nodes, Table edges, boolean directed, String sourceKey, String targetKey)(Code) | | Create a new Graph, using node table row numbers to uniquely
identify nodes in the edge table's source and target fields.
Parameters: nodes - the backing table to use for node data.Node instances of this graph will get their data from this table. Parameters: edges - the backing table to use for edge data.Edge instances of this graph will get their data from this table. Parameters: directed - true for directed edges, false for undirected Parameters: sourceKey - data field used to denote the source node in an edgetable Parameters: targetKey - data field used to denote the target node in an edgetable |
Graph | public Graph(Table nodes, Table edges, boolean directed, String nodeKey, String sourceKey, String targetKey)(Code) | | Create a new Graph.
Parameters: nodes - the backing table to use for node data.Node instances of this graph will get their data from this table. Parameters: edges - the backing table to use for edge data.Edge instances of this graph will get their data from this table. Parameters: directed - true for directed edges, false for undirected Parameters: nodeKey - data field used to uniquely identify a node. If thisfield is null, the node table row numbers will be used Parameters: sourceKey - data field used to denote the source node in an edgetable Parameters: targetKey - data field used to denote the target node in an edgetable |
addEdge | public int addEdge(int s, int t)(Code) | | Add an edge to the graph. Both multiple edges between two nodes
and edges from a node to itself are allowed.
Parameters: s - the source node id Parameters: t - the target node id the edge id (edge table row number) of the added edge |
addEdge | public Edge addEdge(Node s, Node t)(Code) | | Add an edge to the graph.
Parameters: s - the source Node Parameters: t - the target Node the new Edge instance |
addGraphModelListener | public void addGraphModelListener(GraphListener listnr)(Code) | | Add a listener to be notified of changes to the graph.
Parameters: listnr - the listener to add |
addLink | protected void addLink(String field, int len, int n, int e)(Code) | | Internal method for adding a link to an adjacency list
Parameters: field - which adjacency list (inlinks or outlinks) to use Parameters: len - the length of the adjacency list Parameters: n - the node id of the adjacency list to use Parameters: e - the edge to add to the list |
addNode | public Node addNode()(Code) | | Add a new node to the graph.
the new Node instance |
addNodeRow | public int addNodeRow()(Code) | | Add row to the node table, thereby adding a node to the graph.
the node id (node table row number) of the added node |
clearEdges | protected void clearEdges()(Code) | | Internal method for clearing the edge table, removing all edges.
|
clearSpanningTree | public void clearSpanningTree()(Code) | | Clear the internally stored spanning tree. Any new calls to a
getSpanningTree() method will generate a new spanning tree
instance as needed.
This method is primarily useful for subclasses.
For example, calling this method on a Tree instance will revert the
state to the original rooted tree such that a sbusequent call to
getSpanningTree() will return the backing Tree itself.
See Also: Graph.getSpanningTree() See Also: Graph.getSpanningTree(Node) See Also: Tree.getSpanningTree(Node) |
createLinkTable | protected Table createLinkTable()(Code) | | Instantiate and return the link table.
the created link table |
dispose | public void dispose()(Code) | | Dispose of this graph. Unregisters this graph as a listener to its
included tables.
|
edgeCheck | protected boolean edgeCheck(Edge e, boolean throwException)(Code) | | Internal method for checking the validity of an edge.
Parameters: e - the Edge to check for validity Parameters: throwException - true if this method should throw an Exceptionwhen an invalid node is encountered true is the edge is valid, false if invalid |
edgeRows | public IntIterator edgeRows()(Code) | | Get an iterator over all edge ids (edge table row numbers).
an iterator over all edge ids (edge table row numbers) |
edgeRows | public IntIterator edgeRows(int node)(Code) | | Get an iterator over all edge ids for edges incident on the given node.
Parameters: node - a node id (node table row number) an iterator over all edge ids for edges incident on the givennode |
edgeRows | public IntIterator edgeRows(int node, int direction)(Code) | | Get an iterator edge ids for edges incident on the given node.
Parameters: node - a node id (node table row number) Parameters: direction - the directionality of the edges to include. One ofGraph.INEDGES (for in-linking edges),Graph.OUTEDGES (for out-linking edges), orGraph.UNDIRECTED (for all edges). an iterator over all edge ids for edges incident on the givennode |
edges | public Iterator edges()(Code) | | Get an iterator over all edges in the graph.
an iterator over Edge instances |
edges | public Iterator edges(Node node)(Code) | | Get an iterator over all Edges connected to the given Node in the graph.
Parameters: node - a Node in the graph an iterator over all Edges connected to the input node |
getAdjacentNode | public int getAdjacentNode(int edge, int node)(Code) | | Given an edge id and an incident node id, return the node id for
the other node connected to the edge.
Parameters: edge - an edge id (edge table row number) Parameters: node - a node id (node table row number). This node id mustbe connected to the edge the adjacent node id |
getAdjacentNode | public Node getAdjacentNode(Edge e, Node n)(Code) | | Given an Edge and an incident Node, return the other Node
connected to the edge.
Parameters: e - an Edge instance Parameters: n - a Node instance. This node mustbe connected to the edge the adjacent Node |
getDegree | public int getDegree(int node)(Code) | | Get the degree of a node, the number of edges for which a node
is either the source or the target.
Parameters: node - the node id (node table row number) the total degree of the node |
getDegree | public int getDegree(Node n)(Code) | | Get the degree of a node, the number of edges for which a node
is either the source or the target.
Parameters: n - the Node instance the total degree of the node |
getEdge | public Edge getEdge(int e)(Code) | | Get the Edge tuple instance corresponding to an edge id.
Parameters: e - an edge id (edge table row number) the Node instance corresponding to the node id |
getEdge | public int getEdge(int source, int target)(Code) | | Returns an edge from the source node to the target node. This
method returns the first such edge found; in the case of multiple
edges there may be more.
|
getEdge | public Edge getEdge(Node source, Node target)(Code) | | Get an Edge with given source and target Nodes. There may be times
where there are multiple edges between two nodes; in those cases
this method returns the first such edge found.
Parameters: source - the source Node Parameters: target - the target Node an Edge with given source and target nodes, or null if nosuch edge is found. |
getEdgeCount | public int getEdgeCount()(Code) | | Get the number of edges in this graph.
the number of edges |
getEdgeSourceField | public String getEdgeSourceField()(Code) | | Get the data field used to denote the source node in an edge table.
the data field used to denote the source node in an edge table. |
getEdgeTable | public Table getEdgeTable()(Code) | | Get the backing edge table.
the table of edge values |
getEdgeTargetField | public String getEdgeTargetField()(Code) | | Get the data field used to denote the target node in an edge table.
the data field used to denote the target node in an edge table. |
getInDegree | public int getInDegree(int node)(Code) | | Get the in-degree of a node, the number of edges for which the node
is the target.
Parameters: node - the node id (node table row number) the in-degree of the node |
getInDegree | public int getInDegree(Node n)(Code) | | Get the in-degree of a node, the number of edges for which the node
is the target.
Parameters: n - the Node instance the in-degree of the node |
getKey | public long getKey(int node)(Code) | | Given a node id (a row number in the node table), get the value of
the node key field.
Parameters: node - the node id the value of the node key field for the given node |
getNode | public Node getNode(int n)(Code) | | Get the Node tuple instance corresponding to a node id.
Parameters: n - a node id (node table row number) the Node instance corresponding to the node id |
getNodeCount | public int getNodeCount()(Code) | | Get the number of nodes in this graph.
the number of nodes |
getNodeFromKey | public Node getNodeFromKey(long key)(Code) | | Get the Node tuple corresponding to the input node key field value.
The node key field is used to find the node id (node table row number),
which is then used to retrieve the Node tuple.
Parameters: key - a node key field value the requested Node instance |
getNodeIndex | public int getNodeIndex(long key)(Code) | | Given a value of the node key field, get the node id (the row number
in the node table).
Parameters: key - a node key field value the node id (the row number in the node table) |
getNodeKeyField | public String getNodeKeyField()(Code) | | Get the data field used to uniquely identify a node
the data field used to uniquely identify a node |
getNodeTable | public Table getNodeTable()(Code) | | Get the backing node table.
the table of node values |
getOutDegree | public int getOutDegree(int node)(Code) | | Get the out-degree of a node, the number of edges for which the node
is the source.
Parameters: node - the node id (node table row number) the out-degree of the node |
getOutDegree | public int getOutDegree(Node n)(Code) | | Get the out-degree of a node, the number of edges for which the node
is the source.
Parameters: n - the Node instance the out-degree of the node |
getSourceNode | public int getSourceNode(int edge)(Code) | | Get the source node id (node table row number) for the given edge
id (edge table row number).
Parameters: edge - an edge id (edge table row number) the source node id (node table row number) |
getSourceNode | public Node getSourceNode(Edge e)(Code) | | Get the source Node for the given Edge instance.
Parameters: e - an Edge instance the source Node of the edge |
getSpanningTree | public Tree getSpanningTree()(Code) | | Return the current spanning tree over this graph. If no spanning tree
has been constructed, a SpanningTree rooted at the first valid node
found in the node table will be generated.
Spanning trees are generated using an unweighted breadth first search
over the graph structure.
a spanning tree over this graph See Also: Graph.getSpanningTree(Node) See Also: Graph.clearSpanningTree() |
getSpanningTree | public Tree getSpanningTree(Node root)(Code) | | Returns a spanning tree rooted at the specified node. If the current
spanning tree is alrady rooted at the given node, it is simply
returned. Otherwise, the tree is reconstructed at the new root and
made the current spanning tree for this Graph instance.
Spanning trees are generated using an unweighted breadth first search
over the graph structure.
Parameters: root - the node at which to root the spanning tree. a spanning tree over this graph, rooted at the given root See Also: Graph.getSpanningTree() See Also: Graph.clearSpanningTree() |
getTargetNode | public int getTargetNode(int edge)(Code) | | Get the target node id (node table row number) for the given edge
id (edge table row number).
Parameters: edge - an edge id (edge table row number) the target node id (node table row number) |
getTargetNode | public Node getTargetNode(Edge e)(Code) | | Get the target Node for the given Edge instance.
Parameters: e - an Edge instance the target Node of the edge |
inEdgeRows | public IntIterator inEdgeRows(int node)(Code) | | Get an iterator over all edges that have the given node as a target.
That is, edges that link into the given target node.
Parameters: node - a node id (node table row number) an iterator over all edges that have the given node as a target |
inEdges | public Iterator inEdges(Node node)(Code) | | Get an iterator over all in-linking edges to the given Node.
Parameters: node - a Node in the graph an iterator over all in-linking edges to the input target node |
inNeighbors | public Iterator inNeighbors(Node n)(Code) | | Get an iterator over all in-linking neighbor nodes for the given Node.
Parameters: n - a Node in the graph an iterator over all Nodes that point to the input target node |
init | protected void init(Table nodes, Table edges, boolean directed, String nodeKey, String sourceKey, String targetKey)(Code) | | Initialize this Graph instance.
Parameters: nodes - the node table Parameters: edges - the edge table Parameters: directed - the edge directionality Parameters: nodeKey - data field used to uniquely identify a node Parameters: sourceKey - data field used to denote the source node in an edgetable Parameters: targetKey - data field used to denote the target node in an edgetable |
initLinkTable | protected void initLinkTable()(Code) | | Initialize the link table, which holds adjacency lists for this graph.
|
isDirected | public boolean isDirected()(Code) | | Indicates if the edges of this graph are directed or undirected.
true if directed edges, false if undirected edges |
neighbors | public Iterator neighbors(Node n)(Code) | | Get an iterator over all neighbor nodes for the given Node in the graph.
Parameters: n - a Node in the graph an iterator over all Nodes connected to the input node |
nodeCheck | protected boolean nodeCheck(Node n, boolean throwException)(Code) | | Internal method for checking the validity of a node.
Parameters: n - the Node to check for validity Parameters: throwException - true if this method should throw an Exceptionwhen an invalid node is encountered true is the node is valid, false if invalid |
nodeRows | public IntIterator nodeRows()(Code) | | Get an iterator over all node ids (node table row numbers).
an iterator over all node ids (node table row numbers) |
nodes | public Iterator nodes()(Code) | | Get an iterator over all nodes in the graph.
an iterator over Node instances |
outEdgeRows | public IntIterator outEdgeRows(int node)(Code) | | Get an iterator over all edges that have the given node as a source.
That is, edges that link out from the given source node.
Parameters: node - a node id (node table row number) an iterator over all edges that have the given node as a source |
outEdges | public Iterator outEdges(Node node)(Code) | | Get an iterator over all out-linking edges from the given Node.
Parameters: node - a Node in the graph an iterator over all out-linking edges from the input sourcenode |
outNeighbors | public Iterator outNeighbors(Node n)(Code) | | Get an iterator over all out-linking neighbor nodes for the given Node.
Parameters: n - a Node in the graph an iterator over all Nodes pointed to by the input source node |
remLink | protected boolean remLink(String field, int len, int n, int e)(Code) | | Internal method for removing a link from an adjacency list
Parameters: field - which adjacency list (inlinks or outlinks) to use Parameters: len - the length of the adjacency list Parameters: n - the node id of the adjacency list to use Parameters: e - the edge to remove from the list true if the link was removed successfully, false otherwise |
removeAllGraphModelListeners | public void removeAllGraphModelListeners()(Code) | | Removes all listeners on this graph
|
removeEdge | public boolean removeEdge(int edge)(Code) | | Remove an edge from the graph.
Parameters: edge - the edge id (edge table row number) of the edge to remove true if the edge was successfully removed, false if theedge was not found or was not valid |
removeEdge | public boolean removeEdge(Edge e)(Code) | | Remove an edge from the graph.
Parameters: e - the Edge to remove from the graph true if the edge was successfully removed, false if theedge was not found in this graph |
removeGraphModelListener | public void removeGraphModelListener(GraphListener listnr)(Code) | | Remove a listener from this graph.
Parameters: listnr - the listener to remove |
removeNode | public boolean removeNode(int node)(Code) | | Remove a node from the graph, also removing all incident edges.
Parameters: node - the node id (node table row number) of the node to remove true if the node was successfully removed, false if thenode id was not found or was not valid |
removeNode | public boolean removeNode(Node n)(Code) | | Remove a node from the graph, also removing all incident edges.
Parameters: n - the Node to remove from the graph true if the node was successfully removed, false if thenode was not found in this graph |
setEdgeTable | public void setEdgeTable(Table edges)(Code) | | Updates this graph to use a different edge structure for the same nodes.
All other settings will remain the same (e.g., directionality, keys)
Parameters: edges - the new edge table. |
setTupleManagers | public void setTupleManagers(TupleManager ntm, TupleManager etm)(Code) | | Set the tuple managers used to manage the Node and Edge tuples of this
Graph.
Parameters: ntm - the TupleManager to use for nodes Parameters: etm - the TupleManager to use for edges |
updateDegrees | protected void updateDegrees(int e, int incr)(Code) | | Internal method for updating the linkage of this graph.
Parameters: e - the edge id for the updated link Parameters: incr - the increment value, 1 for an added link,-1 for a removed link |
updateDegrees | protected void updateDegrees(int e, int s, int t, int incr)(Code) | | Internal method for updating the linkage of this graph.
Parameters: e - the edge id for the updated link Parameters: s - the source node id for the updated link Parameters: t - the target node id for the updated link Parameters: incr - the increment value, 1 for an added link,-1 for a removed link |
updateNodeData | protected void updateNodeData(int r, boolean added)(Code) | | Update the link table to accomodate an inserted or deleted node
Parameters: r - the node id, also the row number into the link table Parameters: added - indicates if a node was added or removed |
|
|