create-graph-from-datatable

Description

create-graph-from-datatable adaptor creates a graph structure from a datatable containing edge data.

Requires selection of two columns from a datatable - a source and target column. By default, directed is FALSE, which creates a graph with no directionality to the connections. When changed to TRUE, the directionality is set as going from the 'source' to 'target' column.

Inputs

data Type: datatable Required: Yes The datatable containing edge data.

from column Type: text Required: Yes The name of the column containing the origin node of the edge.

to column Type: text Required: Yes The name of the column containing the destination node of the edge.

directed Type: boolean Required: No Specifies whether the graph is directed or not. If unspecified, defaults to False.

Outputs

graph Type: graph A graph structure defining nodes and edges.

Examples

Example 1: Default behaviour.

Inputs:

data:

idfromto

1

A

B

2

B

C

3

C

A

4

C

D

from column: from

to column: to

directed: false

Outputs:

graph:

{ 
    "nodes": [ 
        { "id": "A" }, 
        { "id": "B" }, 
        { "id": "C" }, 
        { "id": "D" } 
    ], 
    "edges": [ 
        { "id": "edge-1", "from": "A", "to": "B", "direction": "none", "attributes": {} }, 
        { "id": "edge-2", "from": "B", "to": "C", "direction": "none", "attributes": {} }, 
        { "id": "edge-3", "from": "C", "to": "A", "direction": "none", "attributes": {} }, 
        { "id": "edge-4", "from": "C", "to": "D", "direction": "none", "attributes": {} } 
    ] 
} 

-> Created an undirected graph from the datatable.

Example 2: Create a directed graph.

Inputs:

data:

idfromto

1

A

B

2

B

C

3

C

A

4

C

D

from column: from

to column: to

directed:true

Outputs:

graph:

{ 
    "nodes": [ 
    { "id": "A" }, 
    { "id": "B" }, 
    { "id": "C" }, 
    { "id": "D" } 
    ], 
    "edges": [ 
        { "id": "edge-1", "from": "A", "to": "B", "direction": "forward", "attributes": {} }, 
        { "id": "edge-2", "from": "B", "to": "C", "direction": "forward", "attributes": {} }, 
        { "id": "edge-3", "from": "C", "to": "A", "direction": "forward", "attributes": {} }, 
        { "id": "edge-4", "from": "C", "to": "D", "direction": "forward", "attributes": {} } 
        ] 
} 

-> Created a directed graph from the datatable.

Use Cases

Last updated