N
- Node parameter typeE
- Edge parameter type@Beta public abstract class AbstractNetwork<N,E> extends Object implements Network<N,E>
Network
. It is recommended to extend
this class rather than implement Network
directly.Constructor and Description |
---|
AbstractNetwork() |
Modifier and Type | Method and Description |
---|---|
Set<E> |
adjacentEdges(Object edge)
Returns the edges which have an
incident node in common with
edge . |
Graph<N> |
asGraph()
Returns a live view of this network as a
Graph . |
int |
degree(Object node)
Returns the count of
node 's incident edges , counting
self-loops twice (equivalently, the number of times an edge touches node ). |
int |
inDegree(Object node)
Returns the count of
node 's incoming edges in a directed
network. |
int |
outDegree(Object node)
Returns the count of
node 's outgoing edges in a directed
network. |
String |
toString()
Returns a string representation of this network.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
adjacentNodes, allowsParallelEdges, allowsSelfLoops, edgeOrder, edges, edgesConnecting, equals, hashCode, incidentEdges, incidentNodes, inEdges, isDirected, nodeOrder, nodes, outEdges, predecessors, successors
public AbstractNetwork()
public Graph<N> asGraph()
Network
Graph
. The resulting Graph
will have
an edge connecting node A to node B if this Network
has an edge connecting A to B.
If this network allows parallel edges
, parallel edges will be
treated as if collapsed into a single edge. For example, the Network.degree(Object)
of a node
in the Graph
view may be less than the degree of the same node in this Network
.
public int degree(Object node)
Network
node
's incident edges
, counting
self-loops twice (equivalently, the number of times an edge touches node
).
For directed networks, this is equal to inDegree(node) + outDegree(node)
.
For undirected networks, this is equal to incidentEdges(node).size()
+ (number of
self-loops incident to node
).
If the count is greater than Integer.MAX_VALUE
, returns Integer.MAX_VALUE
.
public int inDegree(Object node)
Network
node
's incoming edges
in a directed
network. In an undirected network, returns the Network.degree(Object)
.
If the count is greater than Integer.MAX_VALUE
, returns Integer.MAX_VALUE
.
public int outDegree(Object node)
Network
node
's outgoing edges
in a directed
network. In an undirected network, returns the Network.degree(Object)
.
If the count is greater than Integer.MAX_VALUE
, returns Integer.MAX_VALUE
.
public Set<E> adjacentEdges(Object edge)
Network
incident node
in common with
edge
. An edge is not considered adjacent to itself.adjacentEdges
in interface Network<N,E>
Copyright © 2010-2016. All Rights Reserved.