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
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 603 of file temporalmotifs.cpp.

References TVec< TVal, TSizeTy >::Len(), and TExcept::Throw().

Referenced by TempMotifCounter::Count3TEdge3NodeStars(), and TempMotifCounter::Count3TEdgeTriads().

604  {
606  if (events.Len() != timestamps.Len()) {
607  TExcept::Throw("Number of events must match number of timestamps.");
608  }
609  int start = 0;
610  int end = 0;
611  int L = timestamps.Len();
612  for (int j = 0; j < L; j++) {
613  double tj = double(timestamps[j]);
614  // Adjust counts in pre-window [tj - delta, tj)
615  while (start < L && double(timestamps[start]) < tj - delta) {
616  PopPre(events[start]);
617  start++;
618  }
619  // Adjust counts in post-window (tj, tj + delta]
620  while (end < L && double(timestamps[end]) <= tj + delta) {
621  PushPos(events[end]);
622  end++;
623  }
624  // Move current event off post-window
625  PopPos(events[j]);
626  ProcessCurrent(events[j]);
627  PushPre(events[j]);
628  }
629 }
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

Here is the call graph for this function:

Here is the caller graph for this function:

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: