|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsbrt.kernel.math.graph_theory.DirectedGraph<N>
N
- the type of node.public final class DirectedGraph<N>
This class is used to represent directed graphs.
A directed graph is composed of nodes that are connected by unidirectional edges.
Nested Class Summary | |
---|---|
static class |
DirectedGraph.Edge<N>
This class is used to represent the unidirectional edges of a directed graph. |
Constructor Summary | |
---|---|
DirectedGraph(java.util.Set<DirectedGraph.Edge<N>> edges)
Constructs a new directed graph from the provided collection of edges. |
Method Summary | |
---|---|
int |
edges()
Returns the number of edges in this graph. |
java.util.Set<DirectedGraph.Edge<N>> |
getEdges()
Returns the set of all edges contained in this graph. |
java.util.Collection<N> |
getNeighbors(java.lang.Object node)
Returns the neighboring nodes of the provided node. |
java.util.Set<N> |
getNodes()
Returns the set of all nodes contained in this graph. |
java.util.Set<N> |
getPredecessors(java.lang.Object node)
Returns the predecessors of the provided node. |
java.util.Set<N> |
getSuccessors(java.lang.Object node)
Returns the successors of the provided node. |
boolean |
isEdge(java.lang.Object sourceNode,
java.lang.Object sinkNode)
Indicates if an edge exists between the provided nodes. |
boolean |
isNode(java.lang.Object potentialNode)
Indicates if the provided object is a node in this graph. |
int |
neighbors(java.lang.Object node)
Returns the number of nodes neighboring the provided node. |
int |
nodes()
Returns the number of nodes in this graph. |
int |
predecessors(java.lang.Object node)
Returns the number of predecessors of the provided node. |
int |
successors(java.lang.Object node)
Returns the number of successors of the provided node. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DirectedGraph(java.util.Set<DirectedGraph.Edge<N>> edges)
edges
- the collection of all edges contained
in this graph.Method Detail |
---|
public boolean isNode(java.lang.Object potentialNode)
potentialNode
- the reference object with which to
compare.
true
if the provided object is a node in
this graph; false
otherwise.public boolean isEdge(java.lang.Object sourceNode, java.lang.Object sinkNode)
sourceNode
- the source node.sinkNode
- the sink node.
true
if an edge exists between the provided
source and sink nodes; false
otherwise.public java.util.Set<N> getNodes()
public java.util.Set<DirectedGraph.Edge<N>> getEdges()
public int nodes()
public int edges()
public int neighbors(java.lang.Object node)
node
- the node whose number of neighbors will be returned.
java.lang.IllegalArgumentException
- if the provided node
does not exist in this graph.public java.util.Collection<N> getNeighbors(java.lang.Object node)
node
- the node whose neighbors will be returned.
java.lang.IllegalArgumentException
- if the provided node
does not exist in this graph.public int successors(java.lang.Object node)
node
- the node whose number of successors will be
returned.
java.lang.IllegalArgumentException
- if the provided node
does not exist in this graph.public java.util.Set<N> getSuccessors(java.lang.Object node)
node
- the node whose successors will be
returned.
java.lang.IllegalArgumentException
- if the provided node
does not exist in this graph.public int predecessors(java.lang.Object node)
node
- the node whose number of predecessors will be
returned.
java.lang.IllegalArgumentException
- if the provided node
does not exist in this graph.public java.util.Set<N> getPredecessors(java.lang.Object node)
node
- the node whose predecessors will be
returned.
java.lang.IllegalArgumentException
- if the provided node
does not exist in this graph.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |