Catalog PyPI
PACKAGE EXPLORERView in registry

adjacency-list-graphbuilder

PyPI

Build an undirected adjacency-list graph from a list of edges, with automatic node-count inference.

adjacency-listalgorithmsdata-structuresgraph
Versions collected1
Direct dependencies0From release 0.1.1
Last observed20 Oct, 19:35 UTC

README

Version 0.1.1 documentation

adjacency-list-graphbuilder

A tiny utility to build an undirected adjacency-list graph from a list of edges.

If you don't provide n (the number of nodes), it's inferred automatically from the highest node index found in edges.

Note: Version 0.1.0 was published with an incorrect README that referenced an old package name (graphbuilder). The actual importable package name has always been adjacency_list_graphbuilder. This has been corrected starting from version 0.1.1. If you installed 0.1.0, please upgrade using pip install --upgrade adjacency-list-graphbuilder.

Install

pip install adjacency-list-graphbuilder

Usage

from adjacency_list_graphbuilder import build_graph

edges = [[0, 1], [0, 2], [1, 2], [2, 3], [1, 3]]

# n is optional — inferred automatically
graph = build_graph(edges)
print(graph)
# [[1, 2], [0, 2, 3], [0, 1, 3], [2, 1]]

# or provide n explicitly (e.g. to include isolated nodes)
graph = build_graph(edges, n=6)
print(graph)
# [[1, 2], [0, 2, 3], [0, 1, 3], [2, 1], [], []]

License

MIT

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 1

Collected releases
VersionPublishedDirect dependenciesOpen version
0.1.116 Sept 20260

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 19:35 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:151edd7b5b7928fa96d0466292b0f01bd03533359d3c2761e2a1b36434a003fb