SNAP Library 6.0, Developer Reference  2020-12-09 16:24:20
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
ThreeTEdgeMotifCounter Class Reference

#include <temporalmotifs.h>

Collaboration diagram for ThreeTEdgeMotifCounter:

Public Member Functions

 ThreeTEdgeMotifCounter (int size)
 
void Count (const TIntV &event_string, const TIntV &timestamps, double delta, Counter3D &counts)
 

Private Member Functions

void IncrementCounts (int event)
 
void DecrementCounts (int event)
 

Private Attributes

Counter1D counts1_
 
Counter2D counts2_
 
Counter3D counts3_
 
int size_
 

Detailed Description

Definition at line 195 of file temporalmotifs.h.

Constructor & Destructor Documentation

ThreeTEdgeMotifCounter::ThreeTEdgeMotifCounter ( int  size)
inline

Definition at line 198 of file temporalmotifs.h.

198 : size_(size) {}

Member Function Documentation

void ThreeTEdgeMotifCounter::Count ( const TIntV event_string,
const TIntV timestamps,
double  delta,
Counter3D counts 
)

Definition at line 567 of file temporalmotifs.cpp.

References counts1_, counts2_, counts3_, DecrementCounts(), IncrementCounts(), TVec< TVal, TSizeTy >::Len(), size_, and TExcept::Throw().

Referenced by TempMotifCounter::Count3TEdge2Node(), TempMotifCounter::Count3TEdge3NodeStarsNaive(), and TempMotifCounter::Count3TEdgeTriadsNaive().

568  {
569  // Initialize everything to empty
573  if (event_string.Len() != timestamps.Len()) {
574  TExcept::Throw("Number of events must equal number of timestamps");
575  }
576  int start = 0;
577  for (int end = 0; end < event_string.Len(); end++) {
578  while (double(timestamps[start]) + delta < double(timestamps[end])) {
579  DecrementCounts(event_string[start]);
580  start++;
581  }
582  IncrementCounts(event_string[end]);
583  }
584  counts = counts3_;
585 }
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
static void Throw(const TStr &MsgStr)
Definition: ut.h:187
void IncrementCounts(int event)
void DecrementCounts(int event)

Here is the call graph for this function:

Here is the caller graph for this function:

void ThreeTEdgeMotifCounter::DecrementCounts ( int  event)
private

Definition at line 597 of file temporalmotifs.cpp.

References counts1_, counts2_, and size_.

Referenced by Count().

597  {
598  counts1_(event)--;
599  for (int i = 0; i < size_; i++) { counts2_(event, i) -= counts1_(i); }
600 }

Here is the caller graph for this function:

void ThreeTEdgeMotifCounter::IncrementCounts ( int  event)
private

Definition at line 587 of file temporalmotifs.cpp.

References counts1_, counts2_, counts3_, and size_.

Referenced by Count().

587  {
588  for (int i = 0; i < size_; i++) {
589  for (int j = 0; j < size_; j++) {
590  counts3_(i, j, event) += counts2_(i, j);
591  }
592  }
593  for (int i = 0; i < size_; i++) { counts2_(i, event) += counts1_(i); }
594  counts1_(event) += 1;
595 }

Here is the caller graph for this function:

Member Data Documentation

Counter1D ThreeTEdgeMotifCounter::counts1_
private

Definition at line 210 of file temporalmotifs.h.

Referenced by Count(), DecrementCounts(), and IncrementCounts().

Counter2D ThreeTEdgeMotifCounter::counts2_
private

Definition at line 211 of file temporalmotifs.h.

Referenced by Count(), DecrementCounts(), and IncrementCounts().

Counter3D ThreeTEdgeMotifCounter::counts3_
private

Definition at line 212 of file temporalmotifs.h.

Referenced by Count(), and IncrementCounts().

int ThreeTEdgeMotifCounter::size_
private

Definition at line 213 of file temporalmotifs.h.

Referenced by Count(), DecrementCounts(), and IncrementCounts().


The documentation for this class was generated from the following files: