My Project
Public Member Functions
Nation Class Reference

Collection of communities. More...

#include <nation.h>

List of all members.

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")

Detailed Description

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.


Constructor & Destructor Documentation

Nation::Nation ( ) [inline]

Empty Constructor

Nation::Nation ( double  v) [inline]

Threshold Constructor

Nation::Nation ( double  thresh,
string  c,
int  s,
string  d 
) [inline]

Constructor

Parameters:
threshThreshold value to use when considering binary classification matchings (if two communities share a higher fraction of nodes, they are a match)
cCompare class type to use
sNetwork size
dDistance class to use

Member Function Documentation

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.

Parameters:
AlliesSet of communities to compare to (considered the target or truth communities)
Returns:
whether or not the calculation was carried out
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

Parameters:
fileoutFile 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.

Parameters:
filenameFile where communities are listed
void Nation::LoadGraph ( string  filename,
string  delim,
bool  translate 
) [inline]

LoadGraph Function

Read in the network the communities came from

Parameters:
filenameNetwork File
delimetersDelimiters used in Network file
void Nation::loadID ( string  filename,
string  delimiters 
) [inline]

Load an ID coversion file

Parameters:
filenameID filename
delimitersCharacter 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.

Parameters:
filenameFile 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

Parameters:
routStream to print out to
void Nation::setCompare ( string  c,
string  d 
) [inline]

Explicitly set up Compare Classes

Parameters:
cCompare class to initialize
dDistance class to use

The documentation for this class was generated from the following file:
 All Classes Files Functions Variables Typedefs