Package com.google.common.graph
Class AbstractNetwork<N,E>
java.lang.Object
com.google.common.graph.AbstractNetwork<N,E>
- Type Parameters:
N
- Node parameter typeE
- Edge parameter type
- All Implemented Interfaces:
Network<N,
E>
- Direct Known Subclasses:
ImmutableNetwork
This class provides a skeletal implementation of
Network
. It is recommended to extend
this class rather than implement Network
directly.- Since:
- 20.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadjacentEdges
(Object edge) Returns the edges which have anincident node
in common withedge
.asGraph()
Returns a live view of this network as aGraph
.int
Returns the count ofnode
'sincident edges
, counting self-loops twice (equivalently, the number of times an edge touchesnode
).int
Returns the count ofnode
'sincoming edges
in a directed network.int
Returns the count ofnode
'soutgoing edges
in a directed network.toString()
Returns a string representation of this network.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.google.common.graph.Network
adjacentNodes, allowsParallelEdges, allowsSelfLoops, edgeOrder, edges, edgesConnecting, equals, hashCode, incidentEdges, incidentNodes, inEdges, isDirected, nodeOrder, nodes, outEdges, predecessors, successors
-
Constructor Details
-
AbstractNetwork
public AbstractNetwork()
-
-
Method Details
-
asGraph
Description copied from interface:Network
Returns a live view of this network as aGraph
. The resultingGraph
will have an edge connecting node A to node B if thisNetwork
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, theNetwork.degree(Object)
of a node in theGraph
view may be less than the degree of the same node in thisNetwork
. -
degree
Description copied from interface:Network
Returns the count ofnode
'sincident edges
, counting self-loops twice (equivalently, the number of times an edge touchesnode
).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 tonode
).If the count is greater than
Integer.MAX_VALUE
, returnsInteger.MAX_VALUE
. -
inDegree
Description copied from interface:Network
Returns the count ofnode
'sincoming edges
in a directed network. In an undirected network, returns theNetwork.degree(Object)
.If the count is greater than
Integer.MAX_VALUE
, returnsInteger.MAX_VALUE
. -
outDegree
Description copied from interface:Network
Returns the count ofnode
'soutgoing edges
in a directed network. In an undirected network, returns theNetwork.degree(Object)
.If the count is greater than
Integer.MAX_VALUE
, returnsInteger.MAX_VALUE
. -
adjacentEdges
Description copied from interface:Network
Returns the edges which have anincident node
in common withedge
. An edge is not considered adjacent to itself.- Specified by:
adjacentEdges
in interfaceNetwork<N,
E>
-
toString
Returns a string representation of this network.
-