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
@Beta public abstract class AbstractNetwork<N,E> extends java.lang.Object implements Network<N,E>
This class provides a skeletal implementation ofNetwork. It is recommended to extend this class rather than implementNetworkdirectly.- Since:
- 20.0
-
-
Constructor Summary
Constructors Constructor Description AbstractNetwork()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Set<E>adjacentEdges(java.lang.Object edge)Returns the edges which have anincident nodein common withedge.Graph<N>asGraph()Returns a live view of this network as aGraph.intdegree(java.lang.Object node)Returns the count ofnode'sincident edges, counting self-loops twice (equivalently, the number of times an edge touchesnode).intinDegree(java.lang.Object node)Returns the count ofnode'sincoming edgesin a directed network.intoutDegree(java.lang.Object node)Returns the count ofnode'soutgoing edgesin a directed network.java.lang.StringtoString()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
-
-
-
-
Method Detail
-
asGraph
public Graph<N> asGraph()
Description copied from interface:NetworkReturns a live view of this network as aGraph. The resultingGraphwill have an edge connecting node A to node B if thisNetworkhas 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 theGraphview may be less than the degree of the same node in thisNetwork.
-
degree
public int degree(java.lang.Object node)
Description copied from interface:NetworkReturns 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
public int inDegree(java.lang.Object node)
Description copied from interface:NetworkReturns the count ofnode'sincoming edgesin a directed network. In an undirected network, returns theNetwork.degree(Object).If the count is greater than
Integer.MAX_VALUE, returnsInteger.MAX_VALUE.
-
outDegree
public int outDegree(java.lang.Object node)
Description copied from interface:NetworkReturns the count ofnode'soutgoing edgesin a directed network. In an undirected network, returns theNetwork.degree(Object).If the count is greater than
Integer.MAX_VALUE, returnsInteger.MAX_VALUE.
-
adjacentEdges
public java.util.Set<E> adjacentEdges(java.lang.Object edge)
Description copied from interface:NetworkReturns the edges which have anincident nodein common withedge. An edge is not considered adjacent to itself.- Specified by:
adjacentEdgesin interfaceNetwork<N,E>
-
toString
public java.lang.String toString()
Returns a string representation of this network.- Overrides:
toStringin classjava.lang.Object
-
-