Class: BuilderGraph

BuilderGraph

A BuilderGraph represents a user-defined motif. It is not the result of a search for a motif, but rather it defines the motif structure that should be searched for during a motif search. BuilderGraphs are so named because they are the product of the user-facing graph builder. BuilderGraphs contain BuilderNodes

Constructor

new BuilderGraph(hosts)

Constructs a BuilderGraph with the specified set of hosts.
Parameters:
Name Type Description
hosts Array.<String> The initial set of hosts
Source:

Extends

Methods

addHost(host)

Adds a new host to the BuilderGraph. This method will also create the head and tail nodes for that host. If the provided host name is already a valid host in the BuilderGraph, this method does nothing
Parameters:
Name Type Description
host String The name of the new host.
Source:

addObserver(type, context, callback)

Adds an observer to this graph. The observer will be notified (by invoking the provided callback function) of events when events of the specified type occur. There cannot exist two observers that are identical. The newly added observer will replace another if it is identical to the other one. Two observers are considered identical if they were registered with the same type and callback.

Parameters:
Name Type Description
type function The type of event you want to observe. Use the constructor function of the event class. For example, if you want to observe AddNodeEvents, type would just be "AddNodeEvent".
context * This object will be provided to the callback function when it is invoked.
callback AbstractGraph~ObserverCallback The callback function. The parameters of the callback should be event, context
Inherited From:
Source:

getAllNodes() → {Array.<AbstractNode>}

Gets all nodes including dummy nodes

This function makes no guarantees about the ordering of nodes in the array returned. Also note that a new array is created to prevent modification of the underlying private data structure, so this function takes linear rather than constant time on the number of nodes.

Inherited From:
Source:
Returns:
an array of all nodes in the model
Type
Array.<AbstractNode>

getDummyNodes() → {Array.<AbstractNode>}

Gets all dummy (head/tail) nodes in the graph as an array.

This function makes no guarantees about the ordering of nodes in the array returned. Also note that a new array is created to prevent modification of the underlying private data structure, so this function takes linear rather than constant time on the number of nodes.

Inherited From:
Source:
Returns:
an array of all dummy nodes
Type
Array.<AbstractNode>

getHead(host) → {AbstractNode}

Gets the dummy head node for a host.
Parameters:
Name Type Description
host String the name of the host
Inherited From:
Source:
Returns:
the head node, or null if none is found
Type
AbstractNode

getHosts() → {Array.<String>}

Gets the hosts as an array
Inherited From:
Source:
Returns:
a copy of the array of host names
Type
Array.<String>

getNodes() → {Array.<AbstractNode>}

Gets all non-dummy (i.e non-head and non-tail) nodes in the graph as an array.

This function makes no guarantees about the ordering of nodes in the array returned. Also note that a new array is created to prevent modification of the underlying private data structure, so this function takes linear rather than constant time on the number of nodes.

Inherited From:
Source:
Returns:
an array of all non-dummy nodes
Type
Array.<AbstractNode>

getNodesTopologicallySorted() → {Array.<AbstractNode>}

Returns the non-dummy nodes of the graph in topologically sorted order. A topologically sorted order is one where, for all i and j such that j > i, there does not exist a directed edge from nodes[j] to nodes[i].

In the case that there are multiple permissible orderings, this method makes no guarantees about which one will be returned. This method may not even return the same order each time it's called.

Inherited From:
Source:
Throws:
An exception if the graph contains a cycle. There cannot exist a topologically sorted order if there exists a cycle.
Returns:
the nodes in topologically sorted order.
Type
Array.<AbstractNode>

getTail(host) → {AbstractNode}

Gets the dummy tail node for a host
Parameters:
Name Type Description
host String the name of the host
Inherited From:
Source:
Returns:
the tail node, or null if none is found
Type
AbstractNode

hasHost(host) → {Boolean}

Checks if this graph has the specified host
Parameters:
Name Type Description
host String The host to check for
Inherited From:
Source:
Returns:
True if the host exists
Type
Boolean

removeHost(host)

Removes a host from the model. The host itself and all nodes on the host will be removed. In addition all connections to and from this host will be removed. If the host doesn't exist, this method does nothing
Parameters:
Name Type Description
host String the name of the host to hide
Inherited From:
Source:

removeObserver(type, callback)

Removes an observer from this graph. If the specified observer cannot be found, this function does nothing.

Parameters:
Name Type Description
type function The type of event you want to observe. Use the constructor function of the event class. For example, if you want to remove an observer for AbstractGraphs, type would just be "AddNodeEvent".
callback AbstractGraph~ObserverCallback The callback function.
Inherited From:
Source: