NetWeaveX

NetWeaveX is a Python library for building, analyzing, and storing graphs and networks.
import netweavex as nx
G = nx.Graph()
G.add_edge("A", "B", weight=4)
G.add_edge("B", "D", weight=2)
G.add_edge("A", "C", weight=3)
G.add_edge("C", "D", weight=4)
print(nx.shortest_path(G, "A", "D", weight="weight"))
Installation
pip install netweavex
Python 3.12 or newer is required. Python 3.14.1 is not supported.
The base install has no required third-party dependencies. Install the scientific extras when you want arrays, matrices, data frames, or drawing:
pip install "netweavex[default]"
default | NumPy, SciPy, Matplotlib, pandas |
extra | lxml, PyGraphviz, pydot, SymPy |
test | pytest |
What you can do
- Build undirected, directed, and multigraphs, including views and subgraphs.
- Generate classic, random, lattice, tree, and community graphs.
- Run shortest paths, centrality, clustering, components, flows, matching, isomorphism, and community detection.
- Read and write GraphML, GEXF, GML, edge lists, adjacency lists, and JSON.
- Draw graphs when Matplotlib, Graphviz, or pydot is installed.
Quick start
import netweavex as nx
G = nx.karate_club_graph()
print(G.number_of_nodes(), G.number_of_edges())
print(nx.density(G))
print(sorted(nx.degree_centrality(G), key=nx.degree_centrality(G).get, reverse=True)[:5])
nx.write_graphml(G, "karate.graphml")
H = nx.read_graphml("karate.graphml")
Directed graphs use nx.DiGraph. Multiple edges between the same nodes use nx.MultiGraph or nx.MultiDiGraph.
D = nx.DiGraph([(1, 2), (2, 3), (3, 1)])
print(nx.is_strongly_connected(D))
License
NetWeaveX is released under the 3-clause BSD license. See LICENSE.txt.