Wdg

new Wdg() → {Object}

Class Wdg which stands for weighted directed graph.

Returns:

A graph generated with graphology. See graphology for more details.

Type: 
Object

Members

(static, constant) graph :Object

Instance of a class Graph from graphology.

Type:
  • Object

Methods

(static) addEdge(source, target, r)

Adds an edge from source to target to the graph instance. In case the edge already exists, the edge is updated.

Parameters:
NameTypeDescription
sourceString

The domain name of the source node ( FQDN or SLD ).

targetString

The domain name of the target node ( FQDN or SLD ).

rObject

An HTTP/S request retrieved from the webRequest interface. See webRequest.onBeforeRequest() for more details.

(static) addNode(node, attrs)

Adds a node to the graph instance.

Parameters:
NameTypeDescription
nodeString

The domain name of a node ( FQDN or SLD ).

attrsObject

The attributes of the node.

(static) attributes()

A method to compute the node attributes for a graph instance. NOTE: This method is called after all HTTP/S request have been processed using Wdg.process.

(static) get()

A getter function to retrieve the graph instance.

Returns:

Returns the graph instance.

(static) getEdge(source, target) → {Object}

A function to retrieve a specific edge between source and target.

Parameters:
NameTypeDescription
sourceString

The domain name of the source node ( FQDN or SLD ).

targetString

The domain name of the target node ( FQDN or SLD ).

Returns:

Returns the requested edge in case it exists. Returns undefined otherwise.

Type: 
Object

(static) process(r, options)

A method to process a single HTTP/S request from the dataset. The processing includes the following steps:

  1. Extract source and target using Util.source() and Util.target(), respectively.
  2. Check whether source and target are valid URLs using validator.
  3. Extract the FQDNs of source and target.
  4. Extract the SLDs of source and target using tldjs.
  5. Determine whether r is a first-party or third-party request. Discard all first-party requests unless option firstParty === true.
  6. In case option sld === true use the extracted SLDs of source and target as the node names. Use the FQDNs of source and target otherwise.
  7. Add nodes and edge using Wdg.addNode and Wdg.addEdge.
Parameters:
NameTypeDescription
rObject

An HTTP/S request retrieved from the webRequest interface. See webRequest.onBeforeRequest() for more details.

optionsObject

Options object passed by commander to this function. See https://www.npmjs.com/package/commander#options for more details.