9 int TD3Graph::m_graphIds[] = {6,12,14,36,38,46,78,102,140,164,166,174,238};
28 int TD4Graph::m_graphIds[] = {14, 28, 30, 74, 76, 78, 90, 92, 94, 204, 206, 222, 280, 282, 286,
29 328, 330, 332, 334, 344, 346, 348, 350, 390, 392, 394, 396, 398,
30 404, 406, 408, 410, 412, 414, 454, 456, 458, 460, 462, 468, 470,
31 472, 474, 476, 478, 856, 858, 862, 904, 906, 908, 910, 922, 924,
32 926, 972, 974, 990, 2184, 2186, 2190, 2202, 2204, 2206, 2252, 2254,
33 2270, 2458, 2462, 2506, 2510, 2524, 2526, 3038, 4370, 4374, 4382,
34 4418, 4420, 4422, 4424, 4426, 4428, 4430, 4434, 4436, 4438, 4440,
35 4442, 4444, 4446, 4546, 4548, 4550, 4556, 4558, 4562, 4564, 4566,
36 4572, 4574, 4678, 4682, 4686, 4692, 4694, 4698, 4700, 4702, 4740,
37 4742, 4748, 4750, 4758, 4764, 4766, 4812, 4814, 4830, 4946, 4950,
38 4952, 4954, 4958, 4994, 4998, 5002, 5004, 5006, 5010, 5012, 5014,
39 5016, 5018, 5020, 5022, 5058, 5062, 5064, 5066, 5068, 5070, 5074,
40 5076, 5078, 5080, 5082, 5084, 5086, 6342, 6348, 6350, 6356, 6358,
41 6364, 6366, 6550, 6552, 6554, 6558, 6598, 6602, 6604, 6606, 6614,
42 6616, 6618, 6620, 6622, 6854, 6858, 6862, 6870, 6874, 6876, 6878,
43 7126, 7128, 7130, 7134, 13142, 13146, 13148, 13150, 13260, 13262,
44 13278, 14678, 14686, 14790, 14798, 14810, 14812, 14814, 15258,
45 15262, 15310, 15326, 31710 };
72 IAssert(GraphSz==3 || GraphSz==4);
80 for(
int i=0; i<numOfGraphs; i++) {
90 for(
int j=0; j<graphIds.Len(); j++)
101 if(!
m_graphMaps.
IsKey(graphId)) { printf(
"This graph does not exist: %d\n", graphId); getchar();
return; }
127 for(
int j=0; j<graphIds.Len(); j++)
151 map.
AddDat(it.GetId(), nId);
158 if (start == n-1) perms.
Add(v);
160 for (
int i = start; i < n; i++) {
180 int srcId = eIt.GetSrcNId();
181 int dstId = eIt.GetDstNId();
183 int mSrcId = map.
GetDat(srcId);
184 int mDstId = map.
GetDat(dstId);
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;
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);
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);
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;
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);
289 int srcId = it.GetSrcNId();
290 int dstId = it.GetDstNId();
299 int nodes = sg.
Len();
301 for(
int i=0; i<nodes; i++) {
302 for(
int j=0; j<nodes; j++) {
315 graphIds.
Add(minGraphId);
317 for(
int i=1; i<isoG.
Len(); i++) {
319 if(minGraphId > curGraphId) minGraphId=curGraphId;
321 graphIds.
Add(curGraphId);
int GetNbrNId(const int &NodeN) const
Returns ID of NodeN-th neighboring node.
TNodeI BegNI() const
Returns an iterator referring to the first node in the graph.
THash< TUInt64, TUInt64 > m_graphMaps
THash< TUInt64, TUInt64 > m_graphCounters
static PNGraph New()
Static constructor that returns a pointer to the graph. Call: PNGraph Graph = TNGraph::New().
TNodeI GetNI(const int &NId) const
Returns an iterator referring to the node of ID NId in the graph.
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.
const TDat & GetDat(const PNGraph &Graph) const
Returns the data associated with key Graph.
int GetNodes() const
Returns the number of nodes in the graph.
void operator()(const PNGraph &G, const TIntV &sg)
static void GetPermutations(TIntV &v, int start, TVec< TIntV > &perms)
int AddNode(int NId=-1)
Adds a node of ID NId to the graph.
static int getId(const PNGraph &G, const TIntV &sg)
const TDat & GetDat(const TKey &Key) const
void operator()(const PNGraph &G, const TIntV &sg)
PNGraph GetGraph(const int &GraphId) const
static uint Pow2(const int &pow)
static void GetIsoGraphs(uint64 graphId, int nodes, TVec< PNGraph > &isoG)
static bool IsEdge(const PNGraph &G, int SrcNId, int DstNId)
static void GetNormalizedMap(const PNGraph &G, THash< TInt, TInt > &map)
Edge iterator. Only forward iteration (operator++) is supported.
bool IsKey(const PNGraph &Graph) const
Test whether Graph is an existing key in the hash table.
int AddEdge(const int &SrcNId, const int &DstNId)
Adds an edge from node SrcNId to node DstNId to the graph.
unsigned long long uint64
static uint64 GraphId(const PNGraph &G)
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
static void GetEdges(uint64 graphId, int nodes, TVec< TPair< int, int > > &edges)
static int getId(const PNGraph &G, const TIntV &sg)
TDat & AddDat(const PNGraph &Graph)
Adds a key Graph to the table and returns its data value.
static void GetNormalizedGraph(const PNGraph &G, PNGraph &nG)
TGHash< TUInt64 > m_graphs
void Clr()
Deletes all nodes and edges from the graph.
TNodeI EndNI() const
Returns an iterator referring to the past-the-end node in the graph.
int GetOutDeg() const
Returns out-degree of the current node.
static uint64 GetMinAndGraphIds(const TVec< PNGraph > &isoG, TVec< uint64 > &graphIds)
Node iterator. Only forward iteration (operator++) is supported.
THash< TInt, TInt > m_graphMaps
void Gen(const TSizeTy &_Vals)
Constructs a vector (an array) of _Vals elements.
THash< TInt, TUInt64 > m_graphCounters
static void GetIndGraph(const PNGraph &G, const TIntV &sg, PNGraph &indG)
void operator()(const PNGraph &G, const TIntV &sg)
bool IsKey(const TKey &Key) const
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
static void GetGraph(uint64 graphId, int nodes, PNGraph &G)
TDat & AddDat(const TKey &Key)
TD34GraphCounter(int GraphSz)