SNAP Library 4.0, Developer Reference  2017-07-27 13:18:06
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>

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 565 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().

566  {
567  // Initialize everything to empty
571  if (event_string.Len() != timestamps.Len()) {
572  TExcept::Throw("Number of events must equal number of timestamps");
573  }
574  int start = 0;
575  for (int end = 0; end < event_string.Len(); end++) {
576  while (double(timestamps[start]) + delta < double(timestamps[end])) {
577  DecrementCounts(event_string[start]);
578  start++;
579  }
580  IncrementCounts(event_string[end]);
581  }
582  counts = counts3_;
583 }
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 595 of file temporalmotifs.cpp.

References counts1_, counts2_, and size_.

Referenced by Count().

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

Here is the caller graph for this function:

void ThreeTEdgeMotifCounter::IncrementCounts ( int  event)
private

Definition at line 585 of file temporalmotifs.cpp.

References counts1_, counts2_, counts3_, and size_.

Referenced by Count().

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

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: