gak (JavaScript Graph Analysis Kit for Event-Based Network Data)
Overview
Algorithms
gak.EventRank
provides an implementation of the EventRank algorithm put forth by O’Madadhain & Smyth, 2005.- Further development goals include adding ECODE for event based clustering, as well as other static graph analysis algorithms.
Installation
npm
npm install --save gak
bower
bower install --save gak
Documentation
See http://crosslead.github.io/gak for esdoc generated documentation.
Usage
EventRank
To calculate EventRanks of correspondents
involved in a series of events
sorted by time...
; /** * Events should be an Array of objects of the form... * { time: <Number>, to: <String|Array<String>>, from: <String> } * sorted by the time property. * * NOTE: default parameters assume time is in milliseconds since the epoch */const events = /* Add events here... */ ; const R = events ; // compute EventRank valuesR; console; // => { ranks... } /** * To lazily compute a stream of events, call step()... * * Note, the model will need to be initially fed a set of * correspondents to track */ const correspondents = // email address (or whatever is in the to/from properties of the events) 1... // email address 2...; const R = correspondents ; eventStream; // if lazily computing, the ranks need to be finished by calling done();R; console; // => { ranks... } /** * If 2 (or more) events can occur at the exact same time, * EventRank can process "bucketed" events... */ const correspondents = // email address 1... // email address 2...; const R = correspondents ; let bucket;eventStream; // include last bucket...R; // if lazily computing, the ranks need to be finished by calling done();R; console; // => { ranks... }