NetworkX

Package: networkx · 20 nodes · Graph analysis and network science

Build graph analysis pipelines visually — create graphs, run algorithms, and inspect results on a canvas. NetworkX can run as a standalone project or be enabled as a composable library inside any framework's graph.

Node Reference

NodeTypeInputsOutputs
Create Graphstatement-Graph (nx.Graph)
Add NodestatementGraph (nx.Graph), Node (any)-
Add EdgestatementGraph (nx.Graph), From (any), To (any), Weight (float)-
Has NodeexpressionGraph (nx.Graph), Node (any)Exists (bool)
Has EdgeexpressionGraph (nx.Graph), From (any), To (any)Exists (bool)
NeighborsexpressionGraph (nx.Graph), Node (any)Neighbors (list<any>)
DegreeexpressionGraph (nx.Graph), Node (any)Degree (int)
Node CountexpressionGraph (nx.Graph)Count (int)
Complete GraphexpressionNodes (int)Graph (nx.Graph)
Random GraphexpressionNodes (int), Probability (float)Graph (nx.Graph)
Barabasi AlbertexpressionNodes (int), Edges/Node (int)Graph (nx.Graph)
Grid 2dexpressionRows (int), Cols (int)Graph (nx.Graph)
Shortest PathexpressionGraph (nx.Graph), Source (any), Target (any)Path (list<any>)
Shortest Path LengthexpressionGraph (nx.Graph), Source (any), Target (any)Length (int)
Has PathexpressionGraph (nx.Graph), Source (any), Target (any)Connected (bool)
Degree CentralityexpressionGraph (nx.Graph)Centrality (dict<string, any>)
Betweenness CentralityexpressionGraph (nx.Graph)Centrality (dict<string, any>)
PagerankexpressionGraph (nx.Graph)Ranks (dict<string, any>)
Connected ComponentsexpressionGraph (nx.Graph)Components (list<any>), Count (int)
Is ConnectedexpressionGraph (nx.Graph)Connected (bool)

Creating Graphs

Create Graph is a statement node. Use the dropdown to select the graph type:

TypeDirectedParallel EdgesPython
GraphNoNonx.Graph()
DiGraphYesNonx.DiGraph()
MultiGraphNoYesnx.MultiGraph()
MultiDiGraphYesYesnx.MultiDiGraph()

Add Node generates G.add_node(n). Add Edge generates G.add_edge(u, v) or G.add_edge(u, v, weight=w) when weight is connected.

Graph Generators

Generator nodes are expression nodes — no exec ports, they produce a graph value directly.

  • Complete Graph — Kn: nx.complete_graph(n)
  • Random Graph — Erdos-Renyi: nx.erdos_renyi_graph(n, p)
  • Barabasi-Albert — Scale-free via preferential attachment: nx.barabasi_albert_graph(n, m)
  • Grid 2D — Lattice: nx.grid_2d_graph(m, n)

Querying Graphs

All query nodes are expression nodes resolved when their output is needed.

  • Has Node / Has Edge — Boolean existence checks
  • Neighborslist(G.neighbors(n))
  • DegreeG.degree(n)
  • Node CountG.number_of_nodes()

Paths & Distances

  • Shortest Pathnx.shortest_path(G, source, target) (raises error if no path)
  • Shortest Path Lengthnx.shortest_path_length(G, source, target)
  • Has Pathnx.has_path(G, source, target) (use with Branch for safe path-finding)

Centrality Measures

All return a dict mapping node IDs to float scores.

  • Degree Centrality — Importance by connection count, normalized [0, 1]
  • Betweenness Centrality — How often a node is a bridge between others
  • PageRank — Recursive importance (works best on DiGraph)

Connected Components

  • Connected Components — Returns Components (list of sets) and Count
  • Is Connected — Boolean check for full connectivity

These work on undirected graphs. For directed graphs, Is Connected performs a weak connectivity check.