Package org.tweetyproject.graphs.util
Class GraphUtil
java.lang.Object
org.tweetyproject.graphs.util.GraphUtil
This abstract class contains some auxiliary methods for working
with graphs.
- Author:
- Matthias Thimm
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbetweennessCentralityNormalised
(Graph<T> graph) Computes the normalised betweenness centrality of all nodes, i.e.static ComplexNumber[]
eigenvalues
(Graph<? extends Node> g) Computes the (real parts of the) Eigenvalues of the given graph.static <T extends Node>
Collection<List<T>> Enumerates all chordless circuits of the given graph, i.e.static <T extends Node>
doubleReturns the global clustering coefficient of the graph (if it is directed it is interpreted as an undirected version).static Double
Computes the HITS rank of the given node in the given graph.static <T extends Node>
booleanisConnected
(Graph<T> g) Returns "true" if the graph is (simply) connected, i.e.static boolean
isIsomorphic
(Graph<? extends Node> g1, Graph<? extends Node> g2) Checks whether the two graphs are isomorphic.static Double
Computes the PageRank of the given node in the given graph.static <T extends Node>
intundirecteddiameter
(Graph<T> g) * Returns the (undirected) diameter of the graph, i.e.
-
Constructor Details
-
GraphUtil
public GraphUtil()Default Constructor
-
-
Method Details
-
pageRank
public static Double pageRank(Graph<? extends Node> g, Node n, double dampingFactor, double precision) Computes the PageRank of the given node in the given graph.- Parameters:
g
- a graphn
- a nodedampingFactor
- the damping factor for PageRankprecision
- the precision (smaller values mean higher precision)- Returns:
- the PageRank of the given node in the given graph.
-
hitsRank
Computes the HITS rank of the given node in the given graph.- Parameters:
g
- a graphn
- a nodeprecision
- the precision (smaller values mean higher precision)getAuth
- whether to use Auth (instead of Hub)- Returns:
- the HITS rank of the given node in the given graph.
-
eigenvalues
Computes the (real parts of the) Eigenvalues of the given graph.- Parameters:
g
- some graph- Returns:
- an array of double (the real parts of the Eigenvalues).
-
isIsomorphic
-
undirecteddiameter
-
globalclusteringcoefficient
-
enumerateChordlessCircuits
Enumerates all chordless circuits of the given graph, i.e. all circuits a1,...,an where there is no edge connecting any ak with aj unless k=j+1 or k=j-1. The algorithm of this method is adapted from [Bisdorff, On enumerating chordless circuits in directed graphs, 2010].- Type Parameters:
T
- a Node- Parameters:
g
- some graph- Returns:
- the set of chordless circuits
-
betweennessCentralityNormalised
Computes the normalised betweenness centrality of all nodes, i.e. the number of shortest paths going through each node. The value is normalised by subtracting the minimum number (min) of such shortest paths and dividing by (max-min).- Type Parameters:
T
- a Node- Parameters:
graph
- some graph- Returns:
- a map mapping each node to its betweenness centrality.
-
isConnected
Returns "true" if the graph is (simply) connected, i.e. if there is a path from every node to each other node (ignoring edge directions).- Type Parameters:
T
- a Node- Parameters:
g
- some graph- Returns:
- "true" if the graph is (simply) connected
-