SNAP Library 6.0, User Reference
2020-12-09 16:24:20
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
|
#include "Snap.h"
Go to the source code of this file.
Typedefs | |
typedef TVec< TFlt > | TFtr |
Feature of a node. More... | |
typedef THash< TInt, TFtr > | TIntFtrH |
The node-feature mapping: <node ID, feature>. More... | |
Functions | |
void | PrintFeatures (const TIntFtrH &Features) |
Prints all nodes' feature. More... | |
TIntFtrH | CreateEmptyFeatures (const PUNGraph Graph) |
Creates an empty node-feature mapping of all nodes in the given graph. More... | |
TIntFtrH | CreateEmptyFeatures (const TIntFtrH &Features) |
Creates an empty node-feature mapping of all nodes from an existing mapping. More... | |
int | GetNumFeatures (const TIntFtrH &Features) |
Gets number of features from the node-feature mapping. More... | |
TFtr | GetNthFeature (const TIntFtrH &Features, const int N) |
Gets the n-th feature of all nodes. More... | |
TIntFtrH | ExtractFeatures (const PUNGraph Graph) |
Performs feature extraction, the first step of RolX. More... | |
void | AddNeighborhoodFeatures (const PUNGraph Graph, TIntFtrH &Features) |
Adds neighborhood features (local + egonet) to the node-feature mapping. More... | |
void | AddRecursiveFeatures (const PUNGraph Graph, TIntFtrH &Features) |
Adds recursive features to the node-feature mapping. More... | |
void | AddLocalFeatures (const PUNGraph Graph, TIntFtrH &Features) |
Adds local features to the node-feature mapping. More... | |
void | AddEgonetFeatures (const PUNGraph Graph, TIntFtrH &Features) |
Adds egonet features to the node-feature mapping. More... | |
TIntFtrH | GenerateRecursiveFeatures (const PUNGraph Graph, const TIntFtrH &CurrFeatures) |
Generates recursive features out of current features. More... | |
TIntFtrH | PruneRecursiveFeatures (const PUNGraph Graph, const TIntFtrH &Features, const TIntFtrH &NewFeatures, const int SimilarityThreshold) |
Prunes recursive features. More... | |
void | AppendFeatures (TIntFtrH &DstFeatures, const TIntFtrH &SrcFeatures, const int ColIdx=-1) |
Appends all src features to dst features. More... | |
TIntFtrH | CalcVerticalLogBinning (const TIntFtrH &Features, const float BinFraction) |
Calculates vertical logarithmic binning features from the given features. More... | |
PUNGraph | BuildFeatureGraph (const TIntFtrH &LogFeatures, const int SimilarityThreshold) |
Builds s-friend graph given similarity threshold. More... | |
TIntFtrH | SummarizeConnectedComponents (const PUNGraph FeatureGraph, const TIntFtrH &Features, const TIntFtrH &NewFeatures) |
Summarizes s-friend graph and return retained features. More... | |
TVec< TInt > | GetNIdSorted (const TIntFtrH &Feature, const int Idx) |
Sorts the Idx-th feature, return the list of corresponding node ID. More... | |
void | AssignBinValue (const TVec< TInt > &SortedNId, const float BinFraction, TIntFtrH &LogBinFeatures) |
Assigns logarithmic binning value to features. More... | |
bool | IsSimilarFeature (const TFtr &F1, const TFtr &F2, const int SimilarityThreshold) |
Whether the two features are similar, given similarity threshold. More... | |
TFltVV | ConvertFeatureToMatrix (const TIntFtrH &Features, const TIntIntH &NodeIdMtxIdxH) |
Converts node-feature mapping to matrix. (i, j): i-th node, j-th feature. More... | |
void | PrintMatrix (const TFltVV &Matrix) |
Prints feature matrix to stdout. More... | |
TFltVV | CreateRandMatrix (const int XDim, const int YDim) |
Creates a random matrix with specified dimension. More... | |
bool | FltIsZero (const TFlt Number) |
Whether the float is zero. More... | |
void | CalcNonNegativeFactorization (const TFltVV &V, const int NumRoles, TFltVV &W, TFltVV &H, const double Threshold) |
Performs non-negative factorization V = WH. 2nd dim of W == number of roles. More... | |
TFlt | CalcDescriptionLength (const TFltVV &V, const TFltVV &G, const TFltVV &F) |
Calculates the description length L = M + E. More... | |
TIntIntH | CreateNodeIdMtxIdxHash (const TIntFtrH &Features) |
Creates the mapping of <node ID, matrix index>. More... | |
int | GetMtxIdx (const TInt NodeId, const TIntIntH &NodeIdMtxIdxH) |
Gets matrix index of the node ID. More... | |
TIntIntH | FindRoles (const TFltVV &G, const TIntIntH &NodeIdMtxIdxH) |
Gets matrix index of the node ID. More... | |
void | PlotRoles (const PUNGraph Graph, const TIntIntH &Roles) |
Plots found roles on a picture (.png). More... | |
void | PrintRoles (const TIntIntH &Roles) |
Prints found roles on stdout. More... | |
void | FPrintMatrix (const TFltVV &Matrix, const TStr &Path) |
Prints feature matrix to file. More... | |
void | FPrintNodeMappings (const TIntIntH &NodeIdMtxIdxH, const TStr &Path) |
Prints node mappings to file, feature line -> node ID. More... | |
void | FPrintRoles (const TIntIntH &Roles, const TStr &Path) |
Prints found roles to file. More... | |
Adds egonet features to the node-feature mapping.
Definition at line 87 of file rolx.cpp.
Adds local features to the node-feature mapping.
Definition at line 81 of file rolx.cpp.
Adds neighborhood features (local + egonet) to the node-feature mapping.
Definition at line 57 of file rolx.cpp.
Adds recursive features to the node-feature mapping.
Definition at line 64 of file rolx.cpp.
void AssignBinValue | ( | const TVec< TInt > & | SortedNId, |
const float | BinFraction, | ||
TIntFtrH & | LogBinFeatures | ||
) |
Builds s-friend graph given similarity threshold.
Definition at line 158 of file rolx.cpp.
Calculates the description length L = M + E.
Definition at line 352 of file rolx.cpp.
void CalcNonNegativeFactorization | ( | const TFltVV & | V, |
const int | NumRoles, | ||
TFltVV & | W, | ||
TFltVV & | H, | ||
const double | Threshold | ||
) |
Performs non-negative factorization V = WH. 2nd dim of W == number of roles.
Definition at line 286 of file rolx.cpp.
Calculates vertical logarithmic binning features from the given features.
Definition at line 147 of file rolx.cpp.
Converts node-feature mapping to matrix. (i, j): i-th node, j-th feature.
Definition at line 239 of file rolx.cpp.
Creates an empty node-feature mapping of all nodes in the given graph.
Definition at line 19 of file rolx.cpp.
TFltVV CreateRandMatrix | ( | const int | XDim, |
const int | YDim | ||
) |
Performs feature extraction, the first step of RolX.
Definition at line 48 of file rolx.cpp.
bool FltIsZero | ( | const TFlt | Number | ) |
Generates recursive features out of current features.
Definition at line 97 of file rolx.cpp.
Gets the n-th feature of all nodes.
Definition at line 39 of file rolx.cpp.
int GetNumFeatures | ( | const TIntFtrH & | Features | ) |
Plots found roles on a picture (.png).
void PrintFeatures | ( | const TIntFtrH & | Features | ) |
void PrintMatrix | ( | const TFltVV & | Matrix | ) |
void PrintRoles | ( | const TIntIntH & | Roles | ) |
TIntFtrH PruneRecursiveFeatures | ( | const PUNGraph | Graph, |
const TIntFtrH & | Features, | ||
const TIntFtrH & | NewFeatures, | ||
const int | SimilarityThreshold | ||
) |
Prunes recursive features.
Definition at line 119 of file rolx.cpp.
TIntFtrH SummarizeConnectedComponents | ( | const PUNGraph | FeatureGraph, |
const TIntFtrH & | Features, | ||
const TIntFtrH & | NewFeatures | ||
) |
Summarizes s-friend graph and return retained features.
Definition at line 178 of file rolx.cpp.