# NetworkX

Python graph data structures and algorithms for network analysis and manipulation\.

ID: Q976 · Revision: 1024

Type: software · License: Open\-source software under the three\-clause BSD license\.[^home] · Status: active

Website: https://networkx.org/



NetworkX is a Python package for constructing, manipulating and analyzing graphs\. It supplies graph classes, generators, algorithms, file interchange and basic drawing facilities\. It is a programming library rather than a complete interactive network\-analysis desktop, making data modeling and reproducible scripts central to its use\.[^home][^intro]

## Choose the graph model

Graph and DiGraph represent undirected and directed graphs without parallel edges, while MultiGraph and MultiDiGraph preserve multiple edges between endpoints\. Nodes can be any hashable Python objects, and attributes can hold arbitrary data\. This flexibility makes graph\-class choice important: loading repeated relationships into a simple graph does not represent the same structure as retaining distinct multiedges\.[^intro]

## Scripts and dependencies

NetworkX 3\.7 documents Python 3\.12–3\.14 support\. The base package is pure Python without hard dependencies, but drawing and several analytical facilities use optional scientific\-Python packages\. Additional integrations include Graphviz\-based drawing through PyGraphviz\. An environment that can import NetworkX therefore does not necessarily contain everything needed to run an existing plotting or numerical workflow\.[^install]

## GraphML import details

The reader chooses directed or undirected graph classes from the file and returns a multigraph when parallel edges are present or requested\. Default node and edge attributes remain in graph\-level dictionaries rather than being copied onto every element\. Downstream code that only inspects an element's own attribute dictionary may consequently need to apply those defaults explicitly\.[^reader]

## Interchange limitations

The documented GraphML implementation does not cover mixed directed and undirected edges, hyperedges, nested graphs or ports\. The writer can infer a common numeric attribute type when requested, rather than treating all Python values as automatically serializable\. A graph's in\-memory flexibility should not be confused with complete preservation through a particular exchange format\.[^reader][^writer]

## Backends and cached conversions

Optional third\-party backends can supply different implementations and may require specialized hardware, operating systems or services\. Backend fallback is disabled by default\. Converted graph caching can improve repeated calls but consumes memory; directly mutating attribute dictionaries can leave a cached conversion stale, whereas documented graph mutation methods clear it\. Backend configuration and data\-update patterns are therefore part of the reproducibility context\.[^install][^configs]

## Licensing and substitution

NetworkX uses the three\-clause BSD license and is a candidate substitute for [igraph](/igraph) for supported scripted graph analyses\. The choice depends on needed algorithms, data representation and deployment requirements\. This is not a claim of equivalent performance, identical defaults or source\-code compatibility; representative analyses should retain their graph model and parameter choices during migration\.[^home][^intro][^igraph]

## Capabilities and substitutions

### Programmatic network analysis — supported

Graph classes and algorithms support scripted graph construction, manipulation and analysis\.[^home][^intro]

Use case: Programmatic graph construction and network\-analysis pipelines · Platforms: Windows, macOS, Linux · Region: Version, build and integration requirements apply

### Complete GraphML interchange — unsupported

The implementation excludes mixed directed/undirected graphs, hyperedges, nested graphs and ports\.[^reader][^writer]

Use case: Programmatic graph construction and network\-analysis pipelines · Platforms: Windows, macOS, Linux · Region: Version, build and integration requirements apply

### Automatic backend fallback — limited

Fallback to the NetworkX implementation is disabled by default and must be configured where needed\.[^configs]

Use case: Programmatic graph construction and network\-analysis pipelines · Platforms: Windows, macOS, Linux · Region: Version, build and integration requirements apply

### [Substitute for igraph](/igraph) — limited

Can replace supported programmatic graph\-analysis workflows when Python graph objects and algorithms fit\. Code, node identity, multiedge semantics and backend behavior require adaptation rather than assuming an API\-compatible swap\.[^intro][^install][^igraph]

Use case: Programmatic graph construction and network\-analysis pipelines · Platforms: Windows, macOS, Linux · Region: Version, build and integration requirements apply

## References

[^home]: [NetworkX overview](<https://networkx.org/en/>) — Graph algorithms, portability and BSD license (vendor; retrieved 2026-10-07T16:39:34Z)

[^intro]: [NetworkX introduction](<https://networkx.org/documentation/stable/reference/introduction.html>) — Graph classes, hashable nodes, attributes and live views (vendor; retrieved 2026-10-07T16:37:12Z)

[^install]: [NetworkX installation and dependencies](<https://networkx.org/documentation/stable/install.html>) — 3\.7 Python requirements, optional scientific stack and backends (vendor; retrieved 2026-10-07T16:36:46Z)

[^reader]: [NetworkX GraphML reader](<https://networkx.org/documentation/stable/reference/readwrite/generated/networkx.readwrite.graphml.read_graphml.html>) — GraphML defaults, returned graph class and unsupported constructs (vendor; retrieved 2026-10-07T16:36:59Z)

[^writer]: [NetworkX GraphML writer](<https://networkx.org/documentation/stable/reference/readwrite/generated/networkx.readwrite.graphml.write_graphml.html>) — Unsupported mixed graphs, hyperedges, nesting and ports (vendor; retrieved 2026-10-07T16:36:29Z)

[^configs]: [NetworkX backend configuration](<https://networkx.org/documentation/stable/reference/configs.html>) — Fallback default and converted\-graph cache consistency (vendor; retrieved 2026-10-07T16:36:29Z)

[^igraph]: [Python igraph](<https://python.igraph.org/en/stable/>) — Graph analysis, conversion and plotting (vendor; retrieved 2026-10-07T16:37:12Z)

Source revision: https://substitutefor.net/entities/Q976?revision=1024
