|
Cytoscape 2.8.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface DynamicGraph
A graph whose topology can be modified. Edges and nodes are non-negative integers; a given node and a given edge in a single graph can be the same integer.
Field Summary | |
---|---|
static byte |
DIRECTED_EDGE
A nonnegative quantity representing directedness of an edge. |
static byte |
UNDIRECTED_EDGE
A nonnegative quantity representing undirectedness of an edge. |
Method Summary | |
---|---|
int |
edgeCreate(int sourceNode,
int targetNode,
boolean directed)
Creates a new edge in this graph, having source node, target node, and directedness specified. |
boolean |
edgeRemove(int edge)
Removes the specified edge from this graph. |
IntEnumerator |
edges()
Returns an enumeration of all edges currently in this graph. |
IntEnumerator |
edgesAdjacent(int node,
boolean outgoing,
boolean incoming,
boolean undirected)
Returns a non-repeating enumeration of edges adjacent to a node. |
IntIterator |
edgesConnecting(int node0,
int node1,
boolean outgoing,
boolean incoming,
boolean undirected)
Returns a non-repeating iteration of edges connecting two nodes. |
int |
edgeSource(int edge)
Determines the source node of an edge. |
int |
edgeTarget(int edge)
Determines the target node of an edge. |
byte |
edgeType(int edge)
Determines the existence and directedness of an edge. |
int |
nodeCreate()
Creates a new node in this graph. |
boolean |
nodeExists(int node)
Determines whether or not a node exists in this graph. |
boolean |
nodeRemove(int node)
Removes the specified node from this graph. |
IntEnumerator |
nodes()
Returns an enumeration of all nodes currently in this graph. |
Field Detail |
---|
static final byte DIRECTED_EDGE
static final byte UNDIRECTED_EDGE
Method Detail |
---|
IntEnumerator nodes()
The returned enumeration becomes invalid as soon as any graph-topology-modifying method on this graph is called. Calling methods on an invalid enumeration will result in undefined behavior of that enumeration. Enumerating through a graph's nodes will never have any effect on the graph.
nodes
in interface FixedGraph
IntEnumerator edges()
The returned enumeration becomes invalid as soon as any graph-topology-modifying method on this graph is called. Calling methods on an invalid enumeration will result in undefined behavior of that enumeration. Enumerating through a graph's edges will never have any effect on the graph.
edges
in interface FixedGraph
int nodeCreate()
Implementations may create nodes with arbitrarily large values. Even if implementations initially create nodes with small values, nodes may take ever-increasing values when nodes are continually being removed and created. Or, implementations may choose to re-use node values as nodes are removed and added again.
boolean nodeRemove(int node)
Note that removal of a node necessitates the removal of any edge touching that node.
node
- the node that is to be removed from this graph.
int edgeCreate(int sourceNode, int targetNode, boolean directed)
Implementations may create edges with arbitrarily large values. Even if implementations initially create edges with small values, edges may take ever-increasing values when edges are continually being removed and created. Or, implementations may choose to re-use edge values as edges are removed and added again.
sourceNode
- the source node that the new edge is to have.targetNode
- the target node that the new edge is to have.directed
- the new edge will be directed if and only if this value
is true.
boolean edgeRemove(int edge)
Note that removing an edge does not cause that edge's endpoint nodes to be removed from this graph.
edge
- the edge that is to be removed from this graph.
boolean nodeExists(int node)
Note that this method is superfluous in this interface (that is, it could be removed without losing any functionality), because edgesAdjacent(int, boolean, boolean, boolean) can be used to test the presence of a node. However, because nodeExists(int) does not return a complicated object, its performance may be better than that of edgesAdjacent().
nodeExists
in interface FixedGraph
node
- the [potentially existing] node in this graph whose existence
we're querying.
byte edgeType(int edge)
edgeType
in interface FixedGraph
edge
- the edge in this graph whose existence and/or
directedness we're seeking.
int edgeSource(int edge)
edgeSource
in interface FixedGraph
edge
- the edge in this graph whose source node we're seeking.
int edgeTarget(int edge)
edgeTarget
in interface FixedGraph
edge
- the edge in this graph whose target node we're seeking.
IntEnumerator edgesAdjacent(int node, boolean outgoing, boolean incoming, boolean undirected)
The returned enumeration becomes invalid as soon as any graph-topology-modifying method on this graph is called. Calling methods on an invalid enumeration will result in undefined behavior of that enumeration.
This method returns null if and only if the specified node does not exist in this graph. Therefore, this method can be used to test the existence of a node in this graph.
edgesAdjacent
in interface FixedGraph
node
- the node in this graph whose adjacent edges we're seeking.outgoing
- all directed edges whose source is the node specified
are included in the returned enumeration if this value is true;
otherwise, not a single such edge is included in the returned
enumeration.incoming
- all directed edges whose target is the node specified
are included in the returned enumeration if this value is true;
otherwise, not a single such edge is included in the returned
enumeration.undirected
- all undirected edges touching the specified node
are included in the returned enumeration if this value is true;
otherwise, not a single such edge is included in the returned
enumeration.
IntIterator edgesConnecting(int node0, int node1, boolean outgoing, boolean incoming, boolean undirected)
The returned iteration becomes invalid as soon as any graph-topology-modifying method on this graph is called. Calling methods on an invalid iteration will result in undefined behavior of that iteration.
I'd like to discuss the motivation behind this interface method. I assume that most implementations of this interface will implement this method in terms of edgesAdjacent(). Why, then, is this method necessary? Because some implementations may choose to optimize the implementation of this method by using a search tree or a hashtable, for example. This method is a hook to provide such optimization.
This method returns an IntIterator as opposed to an IntEnumerator so that non-optimized implementations would not be required to pre-compute the number of edges being returned.
edgesConnecting
in interface FixedGraph
node0
- one of the nodes in this graph whose connecting edges
we're seeking.node1
- one of the nodes in this graph whose connecting edges
we're seeking.outgoing
- all directed edges whose source is node0 and whose
target is node1 are included in the returned iteration if this value
is true; otherwise, not a single such edge is included in the returned
iteration.incoming
- all directed edges whose source is node1 and whose
target is node0 are included in the returned iteration if this value
is true; otherwise, not a single such edge is included in the returned
iteration.undirected
- all undirected edges E such that E's endpoints
are node0 and node1 are included in the returned iteration if this
value is true; otherwise, not a single such edge is incuded in the
returned iteration.
|
Cytoscape 2.8.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |