Class IncomingNoReindexSparseDirectedSpecifics
- All Implemented Interfaces:
SparseGraphSpecifics
-
Field Summary
FieldsFields inherited from class org.jgrapht.opt.graph.sparse.specifics.NoIncomingNoReindexSparseDirectedSpecifics
NO_INCOMING, outIncidenceMatrix, source, target, UNMODIFIABLE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlong
Returns the degree of the specified vertex.Returns a set of all edges touching the specified vertex.incomingEdgesOf
(Integer vertex) Returns a set of all edges incoming into the specified vertex.long
inDegreeOf
(Integer vertex) Returns the "in degree" of the specified vertex.protected void
Build the index for the incoming edges.Methods inherited from class org.jgrapht.opt.graph.sparse.specifics.NoIncomingNoReindexSparseDirectedSpecifics
edgesCount, getAllEdges, getEdge, getEdgeSource, getEdgeTarget, getType, outDegreeOf, outgoingEdgesOf, verticesCount
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.jgrapht.opt.graph.sparse.specifics.SparseGraphSpecifics
assertEdgeExist, assertVertexExist, containsEdge, containsVertex, edgeSet, getEdgeWeight, setEdgeWeight, vertexSet
-
Field Details
-
inIncidenceMatrix
Incidence matrix with incoming edges
-
-
Constructor Details
-
IncomingNoReindexSparseDirectedSpecifics
public IncomingNoReindexSparseDirectedSpecifics(int numVertices, int numEdges, Supplier<Stream<Pair<Integer, Integer>>> edges, boolean lazyIncomingEdges) Create a new graph from an edge list.- Parameters:
numVertices
- the number of verticesnumEdges
- the number of edgesedges
- a supplier of an edge streamlazyIncomingEdges
- whether to lazily support incoming edge traversals, only if actually needed by the user
-
-
Method Details
-
degreeOf
Description copied from interface:SparseGraphSpecifics
Returns the degree of the specified vertex.A degree of a vertex in an undirected graph is the number of edges touching that vertex. Edges with same source and target vertices (self-loops) are counted twice.
In directed graphs this method returns the sum of the "in degree" and the "out degree".
- Specified by:
degreeOf
in interfaceSparseGraphSpecifics
- Overrides:
degreeOf
in classNoIncomingNoReindexSparseDirectedSpecifics
- Parameters:
vertex
- vertex whose degree is to be calculated.- Returns:
- the degree of the specified vertex.
-
edgesOf
Description copied from interface:SparseGraphSpecifics
Returns a set of all edges touching the specified vertex. If no edges are touching the specified vertex returns an empty set.- Specified by:
edgesOf
in interfaceSparseGraphSpecifics
- Overrides:
edgesOf
in classNoIncomingNoReindexSparseDirectedSpecifics
- Parameters:
vertex
- the vertex for which a set of touching edges is to be returned.- Returns:
- a set of all edges touching the specified vertex.
-
inDegreeOf
Description copied from interface:SparseGraphSpecifics
Returns the "in degree" of the specified vertex.The "in degree" of a vertex in a directed graph is the number of inward directed edges from that vertex. See http://mathworld.wolfram.com/Indegree.html.
In the case of undirected graphs this method returns the number of edges touching the vertex. Edges with same source and target vertices (self-loops) are counted twice.
- Specified by:
inDegreeOf
in interfaceSparseGraphSpecifics
- Overrides:
inDegreeOf
in classNoIncomingNoReindexSparseDirectedSpecifics
- Parameters:
vertex
- vertex whose degree is to be calculated.- Returns:
- the degree of the specified vertex.
-
incomingEdgesOf
Description copied from interface:SparseGraphSpecifics
Returns a set of all edges incoming into the specified vertex.In the case of undirected graphs this method returns all edges touching the vertex, thus, some of the returned edges may have their source and target vertices in the opposite order.
- Specified by:
incomingEdgesOf
in interfaceSparseGraphSpecifics
- Overrides:
incomingEdgesOf
in classNoIncomingNoReindexSparseDirectedSpecifics
- Parameters:
vertex
- the vertex for which the list of incoming edges to be returned.- Returns:
- a set of all edges incoming into the specified vertex.
-
indexIncomingEdges
protected void indexIncomingEdges()Build the index for the incoming edges.
-