My Project
|
Collection of communities. More...
#include <nation.h>
Public Member Functions | |
Nation () | |
Nation (double v) | |
Nation (double thresh, string c, int s, string d) | |
bool | CalculateBinary (vector< set< string > > Allies) |
void | PrintStats () |
void | PrintStats (ofstream *rout) |
void | load (string filename) |
void | loadLFR (string filename) |
void | loadID (string filename, string delimiters) |
double | getPrecision () |
double | getFScore () |
double | getRecall () |
double | CalculateCompare (vector< set< string > > Allies) |
void | setCompare (string c, string d) |
vector< set< string > > | getCommunities () |
void | LoadGraph (string filename, string delim, bool translate) |
map< string, vector< int > > | CalculateMemberships (vector< set< string > > *comms, string fileout="memberships.dat") |
Collection of communities.
Made up of a set of communities. Class holds member functions to print, load from file, and compare with other sets of communities.
Nation::Nation | ( | ) | [inline] |
Empty Constructor
Nation::Nation | ( | double | v | ) | [inline] |
Threshold Constructor
Nation::Nation | ( | double | thresh, |
string | c, | ||
int | s, | ||
string | d | ||
) | [inline] |
Constructor
thresh | Threshold value to use when considering binary classification matchings (if two communities share a higher fraction of nodes, they are a match) |
c | Compare class type to use |
s | Network size |
d | Distance class to use |
bool Nation::CalculateBinary | ( | vector< set< string > > | Allies | ) | [inline] |
Binary classification comparison with another set of communities. Allies are considered the 'truth'. If two communities have more than threshold similarity, they are a match, and hence a true positive. Allies with no matches are false negatives, communities from this nation with no match are false positives.
Allies | Set of communities to compare to (considered the target or truth communities) |
double Nation::CalculateCompare | ( | vector< set< string > > | Allies | ) | [inline] |
Run the comparison class between the two community sets
map< string, vector <int> > Nation::CalculateMemberships | ( | vector< set< string > > * | comms, |
string | fileout = "memberships.dat" |
||
) | [inline] |
Calculate the community memberships of each node
fileout | File to print memberships to default: memberships.dat |
vector< set < string > > Nation::getCommunities | ( | ) | [inline] |
Retrieve communities
double Nation::getFScore | ( | ) | [inline] |
Retrieve fscore value
double Nation::getPrecision | ( | ) | [inline] |
Retrieve precision value
double Nation::getRecall | ( | ) | [inline] |
Retrieve recall value
void Nation::load | ( | string | filename | ) | [inline] |
Load a set of communities from a file. File should have 1 community per line, preceded with density and size values.
filename | File where communities are listed |
void Nation::LoadGraph | ( | string | filename, |
string | delim, | ||
bool | translate | ||
) | [inline] |
LoadGraph Function
Read in the network the communities came from
filename | Network File |
delimeters | Delimiters used in Network file |
void Nation::loadID | ( | string | filename, |
string | delimiters | ||
) | [inline] |
Load an ID coversion file
filename | ID filename |
delimiters | Character between ID and value in ID conversion file. |
void Nation::loadLFR | ( | string | filename | ) | [inline] |
Load communities from a file in LFR style. Each line has a node ID followed by the IDs of all the communities that node belongs to.
filename | File to load from |
void Nation::PrintStats | ( | ) | [inline] |
Simply print out computed similarity measures (standard out)
void Nation::PrintStats | ( | ofstream * | rout | ) | [inline] |
Print out computed similarity measures to a file
rout | Stream to print out to |
void Nation::setCompare | ( | string | c, |
string | d | ||
) | [inline] |