Class GoldbergMaximumDensitySubgraphAlgorithmNodeWeights<V extends Pair<?,Double>,E>
- java.lang.Object
- 
- org.jgrapht.alg.densesubgraph.GoldbergMaximumDensitySubgraphAlgorithmBase<V,E>
- 
- org.jgrapht.alg.densesubgraph.GoldbergMaximumDensitySubgraphAlgorithmNodeWeights<V,E>
 
 
- 
- Type Parameters:
- V- Type of vertices
- E- Type of edges
 - All Implemented Interfaces:
- MaximumDensitySubgraphAlgorithm<V,E>
 
 public class GoldbergMaximumDensitySubgraphAlgorithmNodeWeights<V extends Pair<?,Double>,E> extends GoldbergMaximumDensitySubgraphAlgorithmBase<V,E> This class computes a maximum density subgraph based on the algorithm described by Andrew Vladislav Goldberg in Finding Maximum Density Subgraphs, 1984, University of Berkley.
 The basic concept is to construct a network that can be used to compute the maximum density subgraph using a binary search approach.This variant of the algorithm assumes the density of a positive real edge and vertex weighted graph G=(V,E) to be defined as \[\frac{\sum\limits_{e \in E} w(e) + \sum\limits_{v \in V} w(v)}{\left|{V}\right|}\] and sets the weights of the network from GoldbergMaximumDensitySubgraphAlgorithmBaseas proposed in the above paper. For this case the weights of the network must be chosen to be: \[c_{ij}=w(ij)\,\forall \{i,j\}\in E\] \[c_{it}=m'+2g-d_i-2w(i)\,\forall i \in V\] \[c_{si}=m'\,\forall i \in V\] where $m'$ is such that all weights are positive and $d_i$ is the degree of vertex $i$ and $w(v)$ is the weight of vertex $v$.
 For details seeGoldbergMaximumDensitySubgraphAlgorithmBase. All the math to prove the correctness of these weights is the same.
 Because the density is per definition guaranteed to be rational, the distance of 2 possible solutions for the maximum density can't be smaller than $\frac{1}{W(W-1)}$. This means shrinking the binary search interval to this size, the correct solution is found. The runtime can in this case be given by $O(M(n,n+m)\log{W})$, where $M(n,m)$ is the runtime of the internally used MinimumSTCutAlgorithmand $W$ is the sum all edge and vertex weights from $G$.- Author:
- Andre Immig
 
- 
- 
Field Summary- 
Fields inherited from class org.jgrapht.alg.densesubgraph.GoldbergMaximumDensitySubgraphAlgorithmBasegraph, guess
 
- 
 - 
Constructor SummaryConstructors Constructor Description GoldbergMaximumDensitySubgraphAlgorithmNodeWeights(Graph<V,E> graph, V s, V t, double epsilon)Convenience constructor that uses PushRelabel as default MinimumSTCutAlgorithmGoldbergMaximumDensitySubgraphAlgorithmNodeWeights(Graph<V,E> graph, V s, V t, double epsilon, Function<Graph<V,DefaultWeightedEdge>,MinimumSTCutAlgorithm<V,DefaultWeightedEdge>> algFactory)Constructor
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description protected doublecomputeDensityDenominator(Graph<V,E> g)protected doublecomputeDensityNumerator(Graph<V,E> g)protected doublegetEdgeWeightFromSourceToVertex(V v)Getter for network weights of edges su for u in Vprotected doublegetEdgeWeightFromVertexToSink(V v)Getter for network weights of edges ut for u in V- 
Methods inherited from class org.jgrapht.alg.densesubgraph.GoldbergMaximumDensitySubgraphAlgorithmBasecalculateDensest, getDensity
 
- 
 
- 
- 
- 
Constructor Detail- 
GoldbergMaximumDensitySubgraphAlgorithmNodeWeightspublic GoldbergMaximumDensitySubgraphAlgorithmNodeWeights(Graph<V,E> graph, V s, V t, double epsilon, Function<Graph<V,DefaultWeightedEdge>,MinimumSTCutAlgorithm<V,DefaultWeightedEdge>> algFactory) Constructor- Parameters:
- graph- input for computation
- s- additional source vertex
- t- additional target vertex
- epsilon- to use for internal computation
- algFactory- function to construct the subalgorithm
 
 - 
GoldbergMaximumDensitySubgraphAlgorithmNodeWeightspublic GoldbergMaximumDensitySubgraphAlgorithmNodeWeights(Graph<V,E> graph, V s, V t, double epsilon) Convenience constructor that uses PushRelabel as default MinimumSTCutAlgorithm- Parameters:
- graph- input for computation
- s- additional source vertex
- t- additional target vertex
- epsilon- to use for internal computation
 
 
- 
 - 
Method Detail- 
computeDensityNumeratorprotected double computeDensityNumerator(Graph<V,E> g) - Specified by:
- computeDensityNumeratorin class- GoldbergMaximumDensitySubgraphAlgorithmBase<V extends Pair<?,Double>,E>
- Parameters:
- g- the graph to compute the numerator density from
- Returns:
- numerator part of the density
 
 - 
computeDensityDenominatorprotected double computeDensityDenominator(Graph<V,E> g) - Specified by:
- computeDensityDenominatorin class- GoldbergMaximumDensitySubgraphAlgorithmBase<V extends Pair<?,Double>,E>
- Parameters:
- g- the graph to compute the denominator density from
- Returns:
- numerator part of the density
 
 - 
getEdgeWeightFromSourceToVertexprotected double getEdgeWeightFromSourceToVertex(V v) Description copied from class:GoldbergMaximumDensitySubgraphAlgorithmBaseGetter for network weights of edges su for u in V- Specified by:
- getEdgeWeightFromSourceToVertexin class- GoldbergMaximumDensitySubgraphAlgorithmBase<V extends Pair<?,Double>,E>
- Parameters:
- v- of V
- Returns:
- weight of the edge (s,v)
 
 - 
getEdgeWeightFromVertexToSinkprotected double getEdgeWeightFromVertexToSink(V v) Description copied from class:GoldbergMaximumDensitySubgraphAlgorithmBaseGetter for network weights of edges ut for u in V- Specified by:
- getEdgeWeightFromVertexToSinkin class- GoldbergMaximumDensitySubgraphAlgorithmBase<V extends Pair<?,Double>,E>
- Parameters:
- v- of V
- Returns:
- weight of the edge (v,t)
 
 
- 
 
-