Package fr.gouv.vitam.common.graph
Class DirectedGraph
- java.lang.Object
-
- fr.gouv.vitam.common.graph.DirectedGraph
-
public class DirectedGraph extends java.lang.ObjectDirectedGraph
-
-
Constructor Summary
Constructors Constructor Description DirectedGraph(com.fasterxml.jackson.databind.JsonNode jsonGraph)Initializes a DirectedGraph from the specified JsonNode.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetId(java.lang.Integer index)Retrieve the id mapping the indexintgetVertices()Returns the number of vertices in this DirectedGraph.intindegree(int vertices)Returns the number of directed edges incident to vertex vertices.DirectedGraphreverse()Returns the reverse of the DirectedGraph.java.lang.StringtoString()Returns a string representation of the graph.
-
-
-
Constructor Detail
-
DirectedGraph
public DirectedGraph(com.fasterxml.jackson.databind.JsonNode jsonGraph)
Initializes a DirectedGraph from the specified JsonNode.- Parameters:
jsonGraph-- Throws:
java.lang.IndexOutOfBoundsException- if the endpoints of any edge are not in prescribed rangejava.lang.IllegalArgumentException- if the number of vertices or edges is negative
-
-
Method Detail
-
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:
java.lang.IndexOutOfBoundsException- unless 0 <= v < vertices
-
reverse
public DirectedGraph reverse()
Returns the reverse of the DirectedGraph.- Returns:
- the reverse of the DirectedGraph (child[parents] to parent[children])
-
toString
public java.lang.String toString()
Returns a string representation of the graph.- Overrides:
toStringin classjava.lang.Object- Returns:
- the number of vertice, adjacency lists
-
getId
public java.lang.String getId(java.lang.Integer index)
Retrieve the id mapping the index- Parameters:
index- index- Returns:
- id
-
-