KADABRA API

LARA API

LARA Common Language API

(.js)
laraImport("lara.graphs.Graphs");

(.lara)
import lara.graphs.Graphs;

Graphs

Graphs

Graphs

Utility class related with graph creation and manipulation.

Current implementation uses Cytoscape.js (https://js.cytoscape.org/)


Static Members

_sanitizeDotLabel

_sanitizeDotLabel(label)

Parameters

label: unknown

addEdge

addEdge(graph, sourceNode, targetNode, edgeData)

Parameters

graph: unknown
sourceNode: unknown
targetNode: unknown
edgeData: unknown

addNode

addNode(graph, nodeData)

Parameters

graph: unknown
nodeData: unknown

isLeaf

isLeaf(node, [loopsAreLeafs = false])

Parameters

node: node
loopsAreLeafs: boolean (optional)

Returns

any - true if the outdegree (number of edges with this node as source) is zero, false otherwise. By default, if a node has a connection to itself (loop) it is not considered a leaf

loadLibrary

loadLibrary()

newGraph

newGraph([config = {}])

Parameters

config: Object - configuration for the graph, according to what Cytoscape accepts as configuration object (optional)

removeNode

removeNode(graph, node, edgeMap)

Removes a node from the graph. Before removing the node, creates connections between all connecting sources and targets.

Parameters

graph: graph
node: node
edgeMap: (edge, edge) -> EdgeData) - function that receives the incoming edge and the outgoing edge, and returns a new EdgeData that replaces both edges

toDot

toDot(graph, dotFormatter)

Parameters

graph: graph
dotFormatter: lara.graphs.DotFormatter

Returns

any