SNAP Library 6.0, User Reference  2020-12-09 16:24:20
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
StarTriad3TEdgeCounter< EdgeData > Class Template Referenceabstract

#include <temporalmotifs.h>

Public Member Functions

 StarTriad3TEdgeCounter ()
 
void Count (const TVec< EdgeData > &events, const TIntV &timestamps, double delta)
 

Protected Member Functions

virtual void InitializeCounters ()=0
 
virtual void PopPre (const EdgeData &event)=0
 
virtual void PopPos (const EdgeData &event)=0
 
virtual void PushPre (const EdgeData &event)=0
 
virtual void PushPos (const EdgeData &event)=0
 
virtual void ProcessCurrent (const EdgeData &event)=0
 

Detailed Description

template<typename EdgeData>
class StarTriad3TEdgeCounter< EdgeData >

Definition at line 219 of file temporalmotifs.h.

Constructor & Destructor Documentation

template<typename EdgeData>
StarTriad3TEdgeCounter< EdgeData >::StarTriad3TEdgeCounter ( )
inline

Definition at line 221 of file temporalmotifs.h.

221 {}

Member Function Documentation

template<typename EdgeData>
void StarTriad3TEdgeCounter< EdgeData >::Count ( const TVec< EdgeData > &  events,
const TIntV timestamps,
double  delta 
)

Definition at line 605 of file temporalmotifs.cpp.

606  {
608  if (events.Len() != timestamps.Len()) {
609  TExcept::Throw("Number of events must match number of timestamps.");
610  }
611  int start = 0;
612  int end = 0;
613  int L = timestamps.Len();
614  for (int j = 0; j < L; j++) {
615  double tj = double(timestamps[j]);
616  // Adjust counts in pre-window [tj - delta, tj)
617  while (start < L && double(timestamps[start]) < tj - delta) {
618  PopPre(events[start]);
619  start++;
620  }
621  // Adjust counts in post-window (tj, tj + delta]
622  while (end < L && double(timestamps[end]) <= tj + delta) {
623  PushPos(events[end]);
624  end++;
625  }
626  // Move current event off post-window
627  PopPos(events[j]);
628  ProcessCurrent(events[j]);
629  PushPre(events[j]);
630  }
631 }
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
virtual void PushPre(const EdgeData &event)=0
virtual void PopPre(const EdgeData &event)=0
virtual void PopPos(const EdgeData &event)=0
virtual void InitializeCounters()=0
static void Throw(const TStr &MsgStr)
Definition: ut.h:187
virtual void ProcessCurrent(const EdgeData &event)=0
virtual void PushPos(const EdgeData &event)=0
template<typename EdgeData>
virtual void StarTriad3TEdgeCounter< EdgeData >::InitializeCounters ( )
protectedpure virtual
template<typename EdgeData>
virtual void StarTriad3TEdgeCounter< EdgeData >::PopPos ( const EdgeData &  event)
protectedpure virtual
template<typename EdgeData>
virtual void StarTriad3TEdgeCounter< EdgeData >::PopPre ( const EdgeData &  event)
protectedpure virtual
template<typename EdgeData>
virtual void StarTriad3TEdgeCounter< EdgeData >::ProcessCurrent ( const EdgeData &  event)
protectedpure virtual
template<typename EdgeData>
virtual void StarTriad3TEdgeCounter< EdgeData >::PushPos ( const EdgeData &  event)
protectedpure virtual
template<typename EdgeData>
virtual void StarTriad3TEdgeCounter< EdgeData >::PushPre ( const EdgeData &  event)
protectedpure virtual

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