FrankenNetworkX

Guide/How it works

Graph Types

1 min readFrom the README

Type Direction Parallel edges Notes
fnx.Graph undirected no The default; G[u][v] returns the edge attribute mapping
fnx.DiGraph directed no successors / predecessors / in_degree / out_degree
fnx.MultiGraph undirected yes (keyed by int) G[u][v][k] returns the per-key attribute mapping
fnx.MultiDiGraph directed yes (keyed by int) Combined directedness + parallel edges

All four provide the core method surface (add_node, add_edge, remove_node, subgraph, copy, to_directed, to_undirected, edges, nodes, degree, adj, __getitem__, etc.). Exact class/member signature differences are classified as partial in the generated FeatureUniverse rather than rounded up to full parity. MultiGraph variants collapse parallel edges transparently when a simple-graph algorithm is invoked.

import franken_networkx as fnx

D = fnx.DiGraph()
D.add_edges_from([(1, 2, {"w": 3}), (2, 3, {"w": 1}), (1, 3, {"w": 5})])

assert list(D.successors(1)) == [2, 3]
assert D.in_degree(3) == 2
assert fnx.is_directed_acyclic_graph(D)
assert list(fnx.topological_sort(D)) == [1, 2, 3]