SNAP Library 4.0, User Reference
2017-07-27 13:18:06
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
|
Small Directed Graphs. More...
#include <ghash.h>
Public Member Functions | |
TGraphKey () | |
TGraphKey (const TSFltV &GraphSigV) | |
TGraphKey (const TIntV &GraphSigV) | |
TGraphKey (const TFltV &GraphSigV) | |
TGraphKey (const TGraphKey &GraphKey) | |
TGraphKey (TSIn &SIn) | |
void | Save (TSOut &SOut) const |
TGraphKey & | operator= (const TGraphKey &GraphKey) |
bool | operator== (const TGraphKey &GraphKey) const |
int | GetPrimHashCd () const |
int | GetSecHashCd () const |
int | GetNodes () const |
Returns the number of nodes in the graph. More... | |
int | GetEdges () const |
Returns the number of edges in the graph. More... | |
int | GetSigLen () const |
Returns the length of the signature vector of a graph. More... | |
int | GetVariant () const |
Returns the graph variant Id. More... | |
void | SetVariant (const int &Variant) |
Sets the Variant Id of a given graph. More... | |
void | SetEdgeV (const TIntPrV &EdgeIdV) |
Returns a vector of directed edges of a graph. More... | |
PNGraph | GetNGraph () const |
Returns the directed graph stored in the GraphKey object. More... | |
void | TakeGraph (const PNGraph &Graph) |
Creates a key from a given directed graph. More... | |
void | TakeGraph (const PNGraph &Graph, TIntPrV &NodeMap) |
Creates a key from a given directed graph. More... | |
void | TakeSig (const PNGraph &Graph, const int &MnSvdGraph, const int &MxSvdGraph) |
Creates a signature for a given directed graph. More... | |
void | SaveTxt (FILE *F) const |
Saves the graph as a list of edges. More... | |
void | SaveGViz (const TStr &OutFNm, const TStr &Desc=TStr(), const TStr &NodeAttrs="", const int &Size=-1) const |
Saves the graph to the .DOT file format used by GraphViz. More... | |
void | DrawGViz (const TStr &OutFNm, const TStr &Desc=TStr(), const TStr &NodeAttrs="", const int &Size=-1) const |
Saves the graph to the .DOT file format and calls GraphViz to draw it. More... | |
Static Public Member Functions | |
static bool | IsIsomorph (const TGraphKey &Key1, const TGraphKey &Key2, const TIntV &NodeIdMap) |
Checks whether directed graph Key1 is isomorphic to the directed graph Key2 under node Id permutation NodeIdMap. More... | |
static bool | IsIsomorph (const TGraphKey &Key1, const TGraphKey &Key2, const TVec< TIntV > &NodeIdMapV) |
Checks whether directed graph Key1 is isomorphic to the directed graph Key2 under all the permutations of node Ids stored in NodeIdMapV. More... | |
static bool | IsIsomorph (const TGraphKey &Key1, const TGraphKey &Key2, const TVec< TIntV > &NodeIdMapV, int &IsoPermId) |
Checks whether directed graph Key1 is isomorphic to the directed graph Key2 under all the permutations of node Ids stored in NodeIdMapV and returns the Id of the permutation of node Ids (IsoPermId) which makes the two graphs isomorphic. More... | |
Public Attributes | |
TInt | Nodes |
TIntPrV | EdgeV |
TFltV | SigV |
TInt | VariantId |
Static Public Attributes | |
static const int | RoundTo = 4 |
Small Directed Graphs.
These graphs are used as keys of the TGHash graph hash table. The main functionality of TGraphKey is that it performs fast graph isomorphism checking to determine whether two graphs (two keys) are the same (i.e., isomorphic).
void TGraphKey::DrawGViz | ( | const TStr & | OutFNm, |
const TStr & | Desc = TStr() , |
||
const TStr & | NodeAttrs = "" , |
||
const int & | Size = -1 |
||
) | const |
Saves the graph to the .DOT file format and calls GraphViz to draw it.
Output type is determined by the OutFNm file extension (.ps, .png).
Definition at line 180 of file ghash.cpp.
|
inline |
PNGraph TGraphKey::GetNGraph | ( | ) | const |
Returns the directed graph stored in the GraphKey object.
Definition at line 47 of file ghash.cpp.
|
inline |
|
inline |
|
inline |
|
inline |
Returns the length of the signature vector of a graph.
Signature is a set of statistics that is used to quickly determine whether the two graphs could be isomorphic. Graphs that differ in their signatures are guaranteed to be non-isomorphic while graphs with identical signatures could still be isomorphic.
Definition at line 40 of file ghash.h.
|
inline |
|
static |
Checks whether directed graph Key1 is isomorphic to the directed graph Key2 under node Id permutation NodeIdMap.
The function does not consider all possible permutations (mappings) between node Ids but only considers mapping in NodeIdMap.
Definition at line 186 of file ghash.cpp.
|
static |
Checks whether directed graph Key1 is isomorphic to the directed graph Key2 under all the permutations of node Ids stored in NodeIdMapV.
Definition at line 197 of file ghash.cpp.
|
static |
Checks whether directed graph Key1 is isomorphic to the directed graph Key2 under all the permutations of node Ids stored in NodeIdMapV and returns the Id of the permutation of node Ids (IsoPermId) which makes the two graphs isomorphic.
|
inline |
void TGraphKey::SaveGViz | ( | const TStr & | OutFNm, |
const TStr & | Desc = TStr() , |
||
const TStr & | NodeAttrs = "" , |
||
const int & | Size = -1 |
||
) | const |
Saves the graph to the .DOT file format used by GraphViz.
Use ".dot" as file extension for OutFNm.
Definition at line 154 of file ghash.cpp.
void TGraphKey::SaveTxt | ( | FILE * | F | ) | const |
Saves the graph as a list of edges.
Definition at line 147 of file ghash.cpp.
|
inline |
|
inline |
void TGraphKey::TakeGraph | ( | const PNGraph & | Graph | ) |
Creates a key from a given directed graph.
Nodes get renumbered to have Ids 0...N-1. Does not create a graph signature.
Definition at line 58 of file ghash.cpp.
Creates a key from a given directed graph.
Parameter NodeMap stores the correspondence of old to new node Ids (0...N-1). Does not create a graph signature. Nodes are renumbered.
Definition at line 74 of file ghash.cpp.
void TGraphKey::TakeSig | ( | const PNGraph & | Graph, |
const int & | MnSvdGraph, | ||
const int & | MxSvdGraph | ||
) |
Creates a signature for a given directed graph.
The function only creates the signature vector but does not copy the graph.
Definition at line 94 of file ghash.cpp.