#include <graphcounter.h>
|
static bool | IsEdge (const PNGraph &G, int SrcNId, int DstNId) |
|
static void | GetEdges (uint64 graphId, int nodes, TVec< TPair< int, int > > &edges) |
|
static void | GetNormalizedGraph (const PNGraph &G, PNGraph &nG) |
|
static void | GetIndGraph (const PNGraph &G, const TIntV &sg, PNGraph &indG) |
|
static void | GetGraph (uint64 graphId, int nodes, PNGraph &G) |
|
static void | GetIsoGraphs (uint64 graphId, int nodes, TVec< PNGraph > &isoG) |
|
static void | GetIsoGraphs (const PNGraph &G, TVec< PNGraph > &isoG) |
|
static uint64 | GraphId (const PNGraph &G) |
|
static uint64 | GraphId (const PNGraph &G, const TIntV &sg) |
|
static uint64 | GetMinAndGraphIds (const TVec< PNGraph > &isoG, TVec< uint64 > &graphIds) |
|
Definition at line 79 of file graphcounter.h.
void TGraphEnumUtils::GetEdges |
( |
uint64 |
graphId, |
|
|
int |
nodes, |
|
|
TVec< TPair< int, int > > & |
edges |
|
) |
| |
|
static |
Definition at line 190 of file graphcounter.cpp.
191 for(
int row=0; row<nodes; row++) {
192 for(
int col=0; col<nodes; col++) {
193 int n = row*nodes+col;
195 uint64 bits = graphId >> n;
unsigned long long uint64
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
void TGraphEnumUtils::GetGraph |
( |
uint64 |
graphId, |
|
|
int |
nodes, |
|
|
PNGraph & |
G |
|
) |
| |
|
static |
Definition at line 269 of file graphcounter.cpp.
272 for(
int i=0; i<nodes; i++) G->
AddNode(i);
274 for(
int row=0; row<nodes; row++) {
275 for(
int col=0; col<nodes; col++) {
276 int n = row*nodes+col;
278 uint64 bits = graphId >> n;
280 if((bits & mask)==1) G->
AddEdge(row, col);
int AddNode(int NId=-1)
Adds a node of ID NId to the graph.
int AddEdge(const int &SrcNId, const int &DstNId)
Adds an edge from node IDs SrcNId to node DstNId to the graph.
unsigned long long uint64
void Clr()
Deletes all nodes and edges from the graph.
Definition at line 251 of file graphcounter.cpp.
253 for(
int i=0; i<sg.
Len(); i++) indG->
AddNode(sg[i]);
255 for(
int i=0; i<sg.
Len(); i++) {
260 for(
int j=0; j<deg; j++) {
262 if(nId == dstId)
continue;
int GetNbrNId(const int &NodeN) const
Returns ID of NodeN-th neighboring node.
TNodeI GetNI(const int &NId) const
Returns an iterator referring to the node of ID NId in the graph.
TSizeTy Len() const
Returns the number of elements in the vector.
int AddNode(int NId=-1)
Adds a node of ID NId to the graph.
int AddEdge(const int &SrcNId, const int &DstNId)
Adds an edge from node IDs SrcNId to node DstNId to the graph.
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
int GetOutDeg() const
Returns out-degree of the current node.
Node iterator. Only forward iteration (operator++) is supported.
void TGraphEnumUtils::GetIsoGraphs |
( |
uint64 |
graphId, |
|
|
int |
nodes, |
|
|
TVec< PNGraph > & |
isoG |
|
) |
| |
|
static |
Definition at line 202 of file graphcounter.cpp.
203 TIntV v(nodes);
for(
int i=0; i<nodes; i++) v[i]=i;
210 for(
int i=0; i<perms.
Len(); i++) {
213 for(
int j=0; j<nodes; j++) isoG[i]->AddNode(j);
215 for(
int j=0; j<edges.
Len(); j++) {
216 int srcId = edges[j].Val1;
217 int dstId = edges[j].Val2;
219 int pSrcId = perms[i][srcId];
220 int pDstId = perms[i][dstId];
222 isoG[i]->AddEdge(pSrcId, pDstId);
static PNGraph New()
Static constructor that returns a pointer to the graph. Call: PNGraph Graph = TNGraph::New().
TSizeTy Len() const
Returns the number of elements in the vector.
static void GetPermutations(TIntV &v, int start, TVec< TIntV > &perms)
static void GetEdges(uint64 graphId, int nodes, TVec< TPair< int, int > > &edges)
void Gen(const TSizeTy &_Vals)
Constructs a vector (an array) of _Vals elements.
Definition at line 227 of file graphcounter.cpp.
230 TIntV v(nodes);
for(
int i=0; i<nodes; i++) v[i]=i;
234 for(
int i=0; i<perms.
Len(); i++) {
237 for(
int j=0; j<nodes; j++) isoG[i]->AddNode(j);
240 int srcId = eIt.GetSrcNId();
241 int dstId = eIt.GetDstNId();
243 int pSrcId = perms[i][srcId];
244 int pDstId = perms[i][dstId];
246 isoG[i]->AddEdge(pSrcId, pDstId);
static PNGraph New()
Static constructor that returns a pointer to the graph. Call: PNGraph Graph = TNGraph::New().
TEdgeI EndEI() const
Returns an iterator referring to the past-the-end edge in the graph.
TSizeTy Len() const
Returns the number of elements in the vector.
TEdgeI BegEI() const
Returns an iterator referring to the first edge in the graph.
int GetNodes() const
Returns the number of nodes in the graph.
static void GetPermutations(TIntV &v, int start, TVec< TIntV > &perms)
Edge iterator. Only forward iteration (operator++) is supported.
void Gen(const TSizeTy &_Vals)
Constructs a vector (an array) of _Vals elements.
Definition at line 311 of file graphcounter.cpp.
315 graphIds.
Add(minGraphId);
317 for(
int i=1; i<isoG.
Len(); i++) {
319 if(minGraphId > curGraphId) minGraphId=curGraphId;
321 graphIds.
Add(curGraphId);
TSizeTy Len() const
Returns the number of elements in the vector.
unsigned long long uint64
static uint64 GraphId(const PNGraph &G)
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
void TGraphEnumUtils::GetNormalizedGraph |
( |
const PNGraph & |
G, |
|
|
PNGraph & |
nG |
|
) |
| |
|
static |
Definition at line 172 of file graphcounter.cpp.
180 int srcId = eIt.GetSrcNId();
181 int dstId = eIt.GetDstNId();
183 int mSrcId = map.
GetDat(srcId);
184 int mDstId = map.
GetDat(dstId);
TEdgeI EndEI() const
Returns an iterator referring to the past-the-end edge in the graph.
TEdgeI BegEI() const
Returns an iterator referring to the first edge in the graph.
int GetNodes() const
Returns the number of nodes in the graph.
int AddNode(int NId=-1)
Adds a node of ID NId to the graph.
const TDat & GetDat(const TKey &Key) const
static void GetNormalizedMap(const PNGraph &G, THash< TInt, TInt > &map)
Edge iterator. Only forward iteration (operator++) is supported.
int AddEdge(const int &SrcNId, const int &DstNId)
Adds an edge from node IDs SrcNId to node DstNId to the graph.
Definition at line 147 of file graphcounter.cpp.
151 map.
AddDat(it.GetId(), nId);
TNodeI BegNI() const
Returns an iterator referring to the first node in the graph.
TNodeI EndNI() const
Returns an iterator referring to the past-the-end node in the graph.
Node iterator. Only forward iteration (operator++) is supported.
TDat & AddDat(const TKey &Key)
void TGraphEnumUtils::GetPermutations |
( |
TIntV & |
v, |
|
|
int |
start, |
|
|
TVec< TIntV > & |
perms |
|
) |
| |
|
staticprivate |
Definition at line 156 of file graphcounter.cpp.
158 if (start == n-1) perms.
Add(v);
160 for (
int i = start; i < n; i++) {
TSizeTy Len() const
Returns the number of elements in the vector.
static void GetPermutations(TIntV &v, int start, TVec< TIntV > &perms)
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition at line 285 of file graphcounter.cpp.
289 int srcId = it.GetSrcNId();
290 int dstId = it.GetDstNId();
TEdgeI EndEI() const
Returns an iterator referring to the past-the-end edge in the graph.
TEdgeI BegEI() const
Returns an iterator referring to the first edge in the graph.
int GetNodes() const
Returns the number of nodes in the graph.
static uint Pow2(const int &pow)
Edge iterator. Only forward iteration (operator++) is supported.
unsigned long long uint64
Definition at line 298 of file graphcounter.cpp.
299 int nodes = sg.
Len();
301 for(
int i=0; i<nodes; i++) {
302 for(
int j=0; j<nodes; j++) {
TSizeTy Len() const
Returns the number of elements in the vector.
static uint Pow2(const int &pow)
static bool IsEdge(const PNGraph &G, int SrcNId, int DstNId)
unsigned long long uint64
static bool TGraphEnumUtils::IsEdge |
( |
const PNGraph & |
G, |
|
|
int |
SrcNId, |
|
|
int |
DstNId |
|
) |
| |
|
inlinestatic |
Definition at line 84 of file graphcounter.h.
86 return G->
IsEdge(SrcNId, DstNId,
true);
bool IsEdge(const int &SrcNId, const int &DstNId, const bool &IsDir=true) const
Tests whether an edge from node IDs SrcNId to DstNId exists in the graph.
The documentation for this class was generated from the following files: