Class: Motif

Motif

A Motif is a set of edges and nodes that are a subgraph of a AbstractGraph. Motifs can be used by other classes to identify or store interesting or useful parts of a larger graph. The exact importance of the edges and nodes stored is left up to the utilizing class.

Constructor

new Motif()

Constructs an empty motif.
Source:

Methods

addAllEdges(edges)

Adds multiple edges to this motif.
Parameters:
Name Type Description
edges Array.<Array.<AbstractNode>> The edges to add. edges[i] is the i-th edge to be added. edge[i][0] and edge[i][1] are the two nodes the i-th edge connects. For example, if you want to add two edges: one from x to y and another from t to w, edges would be [ [x, y], [t, w] ]
Source:

addAllNodes(nodes)

Adds multiple nodes to this motif
Parameters:
Name Type Description
nodes Array.<AbstractNode> An array containing the nodes to add
Source:

addEdge(node1, node2)

Adds an edge to this motif, given the two nodes that the edge connects. Note that this class does not check that the added edge actually exists anywhere or is otherwise meaningful in any way. Such checks are the responsibility of classes utilizing Motif
Parameters:
Name Type Description
node1 AbstractNode One of the nodes the edge connects. Must not be identical to node2
node2 AbstractNode One of the nodes the edge connects. Must not be identical to node1
Source:

addNode(node)

Adds a node to this motif
Parameters:
Name Type Description
node AbstractNode the node to add
Source:

getEdges() → {Array.<Array.<AbstractNode>>}

Gets all the edges in this motif
Source:
Returns:
the edges in this motif. edges[i] is the i-th edge in the motif. edge[i][0] and edge[i][1] are the two nodes the i-th edge connects. For example, if there are two edges: one from x to y and another from t to w, the returned array would be [ [x, y], [t, w] ]
Type
Array.<Array.<AbstractNode>>

getNodes() → {Array.<AbstractNode>}

Gets all nodes that are contained in this motif.
Source:
Returns:
Type
Array.<AbstractNode>

getNumEdges() → {Number}

Gets the number of edges in this motif
Source:
Returns:
the number of edges in this motif
Type
Number

getNumNodes() → {Number}

Gets the number of nodes in this motif
Source:
Returns:
the number of nodes in this motif
Type
Number

merge(other)

Merges two motifs. All of the edges and nodes in other will be added to this. The other motif will be unmodified
Parameters:
Name Type Description
other Motif the other motif to merge into this one
Source: