Package fr.gouv.vitam.common.graph
Class DirectedGraph
java.lang.Object
fr.gouv.vitam.common.graph.DirectedGraph
DirectedGraph
-
Constructor Summary
ConstructorDescriptionDirectedGraph
(com.fasterxml.jackson.databind.JsonNode jsonGraph) Initializes a DirectedGraph from the specified JsonNode. -
Method Summary
Modifier and TypeMethodDescriptionRetrieve the id mapping the indexint
Returns the number of vertices in this DirectedGraph.int
indegree
(int vertices) Returns the number of directed edges incident to vertex vertices.reverse()
Returns the reverse of the DirectedGraph.toString()
Returns a string representation of the graph.
-
Constructor Details
-
DirectedGraph
public DirectedGraph(com.fasterxml.jackson.databind.JsonNode jsonGraph) Initializes a DirectedGraph from the specified JsonNode.- Parameters:
jsonGraph
-- Throws:
IndexOutOfBoundsException
- if the endpoints of any edge are not in prescribed rangeIllegalArgumentException
- if the number of vertices or edges is negative
-
-
Method Details
-
getVertices
public int getVertices()Returns the number of vertices in this DirectedGraph.- Returns:
- the number of vertices in this DirectedGraph
-
indegree
public int indegree(int vertices) Returns the number of directed edges incident to vertex vertices. This is known as the indegree of vertex vertices.- Parameters:
vertices
- the vertex- Returns:
- the indegree of vertex vertices
- Throws:
IndexOutOfBoundsException
- unless 0 <= v < vertices
-
reverse
Returns the reverse of the DirectedGraph.- Returns:
- the reverse of the DirectedGraph (child[parents] to parent[children])
-
toString
Returns a string representation of the graph. -
getId
Retrieve the id mapping the index- Parameters:
index
- index- Returns:
- id
-