399 int numBasicDirMtf = 9;
402 int NodeId = NI.GetId();
403 for (
int e = 0; e < NI.GetOutDeg(); e++) {
404 Counts[NodeId](NI.GetOutNId(e)) =
TIntV(numBasicDirMtf);
408 long nodeID = NI.GetId();
410 for (
long e = 0; e < NI.GetOutDeg(); e++) {
411 long nbrID = NI.GetOutNId(e);
413 neighborsID.
Add(nbrID);
414 Counts[nodeID](nbrID)[0] ++;
415 Counts[nbrID](nodeID)[0] ++;
418 for (
long e = 0; e < NI.GetInDeg(); e++) {
419 long nbrID = NI.GetInNId(e);
421 if (graph->
IsEdge(nodeID, nbrID)) {
422 Counts[nodeID](nbrID)[0] --;
423 Counts[nbrID](nodeID)[0] --;
424 Counts[nodeID](nbrID)[1] ++;
425 Counts[nbrID](nodeID)[1] ++;
427 neighborsID.
Add(nbrID);
428 Counts[nodeID](nbrID)[0] ++;
429 Counts[nbrID](nodeID)[0] ++;
435 long srcNId = EI.GetSrcNId();
436 long dstNId = EI.GetDstNId();
438 if (srcNId > dstNId || !subGraph->
IsEdge(dstNId, srcNId)) {
441 Counts[nodeID](srcNId)[MotifNumber] ++;
442 Counts[srcNId](nodeID)[MotifNumber] ++;
443 Counts[nodeID](dstNId)[MotifNumber] ++;
444 Counts[dstNId](nodeID)[MotifNumber] ++;
445 Counts[srcNId](dstNId)[MotifNumber] ++;
446 Counts[dstNId](srcNId)[MotifNumber] ++;
TNodeI BegNI() const
Returns an iterator referring to the first node in the graph.
TVec< THash< TInt, TIntV > > CountVH
int checkTriadMotif(PNGraph &G, long nodeID, long srcNId, long dstNId)
TEdgeI EndEI() const
Returns an iterator referring to the past-the-end edge in the graph.
int GetMxNId() const
Returns an ID that is larger than any node ID in the graph.
Node iterator. Only forward iteration (operator++) is supported.
TEdgeI BegEI() const
Returns an iterator referring to the first edge in the graph.
bool higherDeg(PUNGraph &G, TUNGraph::TNodeI &NI1, int nodeID2)
Edge iterator. Only forward iteration (operator++) is supported.
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.
PUNGraph GetSubGraph(const PUNGraph &Graph, const TIntV &NIdV, const bool &RenumberNodes)
Returns an induced subgraph of an undirected graph Graph with NIdV nodes with an optional node renumb...
TNodeI EndNI() const
Returns an iterator referring to the past-the-end node in the graph.
Node iterator. Only forward iteration (operator++) is supported.
TNodeI EndNI() const
Returns an iterator referring to the past-the-end node in the graph.
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
TNodeI BegNI() const
Returns an iterator referring to the first node in the graph.