My Project
|
Base class for all community detection algorithms. More...
#include <cluster.h>
Public Member Functions | |
virtual void | calculate ()=0 |
float | get_Density (bidirected_t::graph *graph, const set< bidirected_t::vertex > *cluster) |
float | get_Density (set< lui > *cluster) |
bool | ReadGraph (ifstream *fin, string delimiters=" ,\t", double alpha=1, double beta=1) |
bool | PrintGraph (ofstream *fout) |
bool | PrintCommunities (string filename) |
void | PrintCommunity (set< lui > *comm) |
bool | PrintTranslatedCommunities (string filename) |
void | PrintTranslatedCommunity (set< lui > *comm) |
void | TranslateCommunities () |
void | setOutput (string filename) |
Static Public Member Functions | |
static ClusterAlg * | Create (string type, string args, double alpha, double beta, double weightThresh, bool translate) |
Public Attributes | |
map< lui, map< lui, R > > | network |
vector< set< lui > > | communities |
map< string, lui > | idmap |
map< lui, string > | idLookup |
string | args |
bool | translate |
ostream * | fileout |
Static Public Attributes | |
static density< bidirected_t > * | dens |
Base class for all community detection algorithms.
Holds general purpose functions for all algorithms, but main purpose is as a factory, to create the correct class at runtime.
virtual void ClusterAlg< R >::calculate | ( | ) | [pure virtual] |
Will be the actual algorithm implementation.
Implemented in IterativeDensity< R >, CliqueCluster< R >, SLPA< R >, CONGA< R >, RRW< R >, OSLOM< R >, COPRA< R >, SSDE< R >, and LCOMM< R >.
template ClusterAlg< double > * ClusterAlg< R >::Create | ( | string | type, |
string | args, | ||
double | alpha, | ||
double | beta, | ||
double | weightThresh, | ||
bool | translate | ||
) | [static] |
Factory function
type | Algorithm to create class for |
argList | Arguments to use for algorithm |
alpha | Factor for positive weights |
beta | Factor for negative weights |
weightThresh | Minimum edge weight |
Factory function
type | Algorithm to create class for |
argList | Arguments to use for algorithm |
alpha | Factor for positive weights |
beta | Factor for negative weights |
weightThresh | Minimum edge weight |
translate | Flag indicating whether or not to use original vertex names (from file) |
float ClusterAlg< R >::get_Density | ( | bidirected_t::graph * | graph, |
const set< bidirected_t::vertex > * | cluster | ||
) | [inline] |
Retrieve the density of a set of vertices in a graph using boost structures.
graph | The network the cluster is from |
cluster | Set of vertices in the cluster |
float ClusterAlg< R >::get_Density | ( | set< lui > * | cluster | ) | [inline] |
Retrieve density of a set of vertices
cluster | IDs of vertices in the community |
bool ClusterAlg< R >::PrintCommunities | ( | string | filename | ) | [inline] |
Print detected communities to file. Each line in the output file is as follows:
CommunityDensity CommunitySize Vertex1ID Vertex2ID Vertex3ID ...
filename | String representing filename to print communities to |
Reimplemented in IterativeDensity< R >.
void ClusterAlg< R >::PrintCommunity | ( | set< lui > * | comm | ) | [inline] |
Print a single community to the out file
CommunityDensity CommunitySize Vertex1ID Vertex2ID Vertex3ID ...
comm | Set of vertices to print out |
bool ClusterAlg< R >::PrintGraph | ( | ofstream * | fout | ) | [inline] |
Print the network to a file
fout | Stream to print file to |
bool ClusterAlg< R >::PrintTranslatedCommunities | ( | string | filename | ) | [inline] |
Print detected communities to file. Each line in the output file is as follows:
CommunityDensity CommunitySize Vertex1 Vertex2 Vertex3 ...
filename | String representing filename to print communities to |
Reimplemented in IterativeDensity< R >.
void ClusterAlg< R >::PrintTranslatedCommunity | ( | set< lui > * | comm | ) | [inline] |
Print a single community to the out file (with translated names)
CommunityDensity CommunitySize Vertex1_OriginalID Vertex2_OriginalID Vertex3_OriginalID ...
comm | Set of vertices to print out |
bool ClusterAlg< R >::ReadGraph | ( | ifstream * | fin, |
string | delimiters = " ,\t" , |
||
double | alpha = 1 , |
||
double | beta = 1 |
||
) | [inline] |
Read network from a file and save. Each vertex read in is given a numerical ID that it used throughout the detection process. (Easier comparison between numbers than strings). This can be translated back later.
fin | Stream to read network from |
delimiters | Delimiters between the vertex IDs and edge weights in the network file. |
void ClusterAlg< R >::TranslateCommunities | ( | ) | [inline] |
As long as the original vertex IDs were also numerical (integers), this function will retrieve the original vertex IDs without printing out the communities. Useful for comparing results to benchmark 'ground truth's.
Reimplemented in IterativeDensity< R >.
string ClusterAlg< R >::args |
Clustering Algorithm Arguments
vector< set < lui > > ClusterAlg< R >::communities |
Structure to hold resulting communities
density< bidirected_t > * ClusterAlg< R >::dens [static] |
Community density calculation method to use
ostream* ClusterAlg< R >::fileout |
Place to print output
map<lui, string> ClusterAlg< R >::idLookup |
For faster translating
map<string, lui> ClusterAlg< R >::idmap |
Holds map to original vertex names
map<lui, map <lui, R> > ClusterAlg< R >::network |
Structure to hold network
bool ClusterAlg< R >::translate |