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);
407 for (
TNGraph::TNodeI NI = graph->BegNI(); NI < graph->EndNI(); NI ++ ) {
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] ++;
434 for (
TNGraph::TEdgeI EI = subGraph->BegEI(); EI < subGraph->EndEI(); EI ++ ) {
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] ++;
TVec< THash< TInt, TIntV > > CountVH
int checkTriadMotif(PNGraph &G, long nodeID, long srcNId, long dstNId)
int GetMxNId() const
Returns an ID that is larger than any node ID in the graph.
Node iterator. Only forward iteration (operator++) is supported.
bool higherDeg(PUNGraph &G, TUNGraph::TNodeI &NI1, int nodeID2)
Edge iterator. Only forward iteration (operator++) is supported.
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...
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.