|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object it.unimi.dsi.law.graph.LayeredLabelPropagation
public class LayeredLabelPropagation
An implementation of the layered label propagation algorithm described by by Paolo Boldi, Sebastiano Vigna, Marco Rosa, Massimo Santini, and Sebastiano Vigna in “Layered label propagation: A multiresolution coordinate-free ordering for compressing social networks”, Proceedings of the 20th international conference on World Wide Web, pages 587−596, ACM, 2011.
The method computePermutation(double[], String, int)
returns a permutation of the original
symmetric graph provided with the constructor
which will (hopefully) increase locality (see the paper). Usually, the permutation is fed to
Transform.mapOffline(ImmutableGraph, int[], int, File, ProgressLogger)
to permute the original graph.
Note that the graph provided must be symmetric and loopless. If this is not the case,
please use Transform.symmetrizeOffline(ImmutableGraph, int, File, ProgressLogger)
and possibly
Transform.filterArcs(ImmutableGraph, it.unimi.dsi.webgraph.Transform.ArcFilter, ProgressLogger)
with
filter Transform.NO_LOOPS
to generate a suitable graph.
This class can also be used to run just label propagation over a given graph to get the labels assigned to the nodes for a fixed γ.
This class requires 13 bytes per node (three integers and a boolean), plus the memory
that is necessary to load the graph, which however can be just
memory-mapped
.
Note that the main method will warm up the algorithm by performing a depth-first visit if the graph is not mapped. The visit will require storing an additional array of integers.
Field Summary | |
---|---|
static int |
MAX_UPDATES
The default maximum number of updates. |
Constructor Summary | |
---|---|
LayeredLabelPropagation(ImmutableGraph symGraph,
int[] startPerm,
long seed)
Creates a new instance using a specific initial permutation. |
|
LayeredLabelPropagation(ImmutableGraph symGraph,
int[] startPerm,
long seed,
boolean exact)
Creates a new instance using a specific initial permutation. |
|
LayeredLabelPropagation(ImmutableGraph symGraph,
long seed)
Creates a new instance. |
Method Summary | |
---|---|
AtomicIntegerArray |
computeLabels(double gamma)
Computes the labels of a graph for a given value of γ using the default maximum number of updates. |
AtomicIntegerArray |
computeLabels(double gamma,
int maxUpdates)
Computes the labels of a graph for a given value of γ. |
int[] |
computePermutation(double[] gammas,
String cluster)
Computes the final permutation of the graph using the default maximum number of updates. |
int[] |
computePermutation(double[] gammas,
String cluster,
int maxUpdates)
Computes the final permutation of the graph. |
void |
labelBasename(String labelBasename)
Sets the basename for label files. |
static void |
main(String[] args)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int MAX_UPDATES
Constructor Detail |
---|
public LayeredLabelPropagation(ImmutableGraph symGraph, long seed) throws IOException
symGraph
- a symmetric, loopless graph.seed
- a random seed.
IOException
public LayeredLabelPropagation(ImmutableGraph symGraph, int[] startPerm, long seed) throws IOException
symGraph
- a symmetric, loopless graph.startPerm
- an initial permutation of the graph, or null
for no permutation.seed
- a random seed.
IOException
public LayeredLabelPropagation(ImmutableGraph symGraph, int[] startPerm, long seed, boolean exact) throws IOException
If exact
is true, the final permutation is
exactly the same as if you first permute the graph with startPerm
and
then apply LLP with an null
starting permutation.
symGraph
- a symmetric, loopless graph.startPerm
- an initial permutation of the graph, or null
for no permutation.seed
- a random seed.exact
- a boolean flag that forces the algorithm to run exactly.
IOException
Method Detail |
---|
public void labelBasename(String labelBasename)
labelBasename
- basename for label files.public AtomicIntegerArray computeLabels(double gamma)
gamma
- the gamma parameter.
public AtomicIntegerArray computeLabels(double gamma, int maxUpdates)
gamma
- the gamma parameter.maxUpdates
- the maximum number of updates performed.
public int[] computePermutation(double[] gammas, String cluster) throws IOException
gammas
- a set of parameters that will be used to generate labellings.cluster
- if not null
, clusters will be saved to a file with this name.
IOException
public int[] computePermutation(double[] gammas, String cluster, int maxUpdates) throws IOException
gammas
- a set of parameters that will be used to generate labellings.cluster
- if not null
, clusters will be saved to a file with this name.maxUpdates
- the maximum number of updates performed.
IOException
public static void main(String[] args) throws IOException, JSAPException
IOException
JSAPException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |