Package com.pnfsoftware.jeb.util.graph
Class Digraph
java.lang.Object
com.pnfsoftware.jeb.util.graph.Digraph
A directed graph object, cyclic or acyclic. Self-loops (x>x) are also allowed. Duplicate edges
are not allowed, e.g. if an edge x>y exists, another edge x>y cannot be added (a way to represent
this information is to specify an edge weight).
-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Compute the edge-betweenness score of all edges of the graph using Girvan-Newman.static Digraph
create()
done()
Clients can call this method to indicate that the initial graph is built: after calling this method, additions of vertices or edges is forbidden.e
(int srcId, int dstId) getEdge
(int index) getEdge
(int srcId, int dstId) int
getEdges()
getReachableVertices
(int fromId) getVertex
(int id) getVertexByIndex
(int index) int
getVertexLabel
(int id) boolean
isAdjacent
(Digraph.V from, Digraph.V to) boolean
Determine if this directed graph is weakly connected, that is, if the similar undirected graph is connected.static Digraph
void
removeEdge
(int index) void
void
removeVertex
(Digraph.V v, boolean reconnectEdges) void
void
setVertexLabel
(int id, String label) void
setVertexLabels
(Object... idLabels) toString()
v
(int id) Add a vertex to this graph.
-
Constructor Details
-
Digraph
public Digraph()
-
-
Method Details
-
create
-
copyOfVertices
-
copyOfEdges
-
getVertexCount
public int getVertexCount() -
getVertices
-
getVertex
-
getVertexByIndex
-
getVertexLabel
-
setVertexLabel
-
setVertexLabels
-
removeVertex
-
getEdgeCount
public int getEdgeCount() -
getEdges
-
getEdge
-
removeEdge
-
removeEdge
public void removeEdge(int index) -
getEdge
-
v
Add a vertex to this graph.- Parameters:
id
-weight
- optionallabel
- optional- Returns:
-
v
-
v
-
e
-
e
-
done
Clients can call this method to indicate that the initial graph is built: after calling this method, additions of vertices or edges is forbidden. However, removal of edges is allowed. -
resetEdgeBetweennessScores
public void resetEdgeBetweennessScores() -
computeEdgeBetweenness
Compute the edge-betweenness score of all edges of the graph using Girvan-Newman. The scores are placed inDigraph.E.ebscore
.- Returns:
- a list of edge indexes ordered by descending order of edge-betweenness score; e.g., if the first element of the list is 2, it means that the third registered edge (getEdge(2)) is the one with the highest EB score
-
getEdgeIndexesByDescendingBetweenness
-
getVertexIndexesByDescendingCentrality
-
isWeaklyConnected
public boolean isWeaklyConnected()Determine if this directed graph is weakly connected, that is, if the similar undirected graph is connected.- Returns:
-
getWeaklyConnectedComponents
-
toString
-
isAdjacent
-
canReach
-
getReachableVertices
-
load
- Parameters:
file
-- Returns:
- Throws:
IOException
-