SNAP Library 4.1, User Reference  2018-07-26 16:30:42
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
ThreeTEdgeMotifCounter Class Reference

#include <temporalmotifs.h>

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.

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)
void ThreeTEdgeMotifCounter::DecrementCounts ( int  event)
private

Definition at line 597 of file temporalmotifs.cpp.

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

Definition at line 587 of file temporalmotifs.cpp.

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 }

Member Data Documentation

Counter1D ThreeTEdgeMotifCounter::counts1_
private

Definition at line 210 of file temporalmotifs.h.

Counter2D ThreeTEdgeMotifCounter::counts2_
private

Definition at line 211 of file temporalmotifs.h.

Counter3D ThreeTEdgeMotifCounter::counts3_
private

Definition at line 212 of file temporalmotifs.h.

int ThreeTEdgeMotifCounter::size_
private

Definition at line 213 of file temporalmotifs.h.


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