No project description provided
Project description
abcd-graph
A python library for generating ABCD graphs.
Installation
pip install abcd-graph
Usage
from abcd_graph import Graph, ABCDParams
params = ABCDParams()
graph = Graph(params).build()
Parameters
params
: An instance ofABCDParams
class.n
: Number of nodes in the graph.logger
A boolean to enable or disable logging to the console. Default isFalse
- no logs are shown.
Exporting
The graph object can be exported to networkx.Graph
object using the to_networkx
method.
from abcd_graph import Graph, ABCDParams
params = ABCDParams()
graph = Graph(params).build().to_networkx()
This requires the networkx
library to be installed.
pip install abcd-graph[networkx]
Another option is an igraph.Graph
object.
from abcd_graph import Graph, ABCDParams
params = ABCDParams()
graph = Graph(params).build().to_igraph()
This requires the igraph
library to be installed.
pip install abcd-graph[igraph]
Finally, the graph can be exported to a numpy.ndarray
object that represents the adjacency matrix
.
from abcd_graph import Graph, ABCDParams
params = ABCDParams()
graph = Graph(params).build().adj_matrix
[!IMPORTANT] If the
build()
method is not run before calling any of the export methods, aRuntimeError
will be raised.
[!NOTE] The
numpy
array is of typenumpy.bool_
. If the graph was not properly generated (loops or multi-edges), aMalformedGraphError
will be raised.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file abcd_graph-0.1.0.tar.gz
.
File metadata
- Download URL: abcd_graph-0.1.0.tar.gz
- Upload date:
- Size: 10.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.2 CPython/3.8.13 Linux/6.5.0-35-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5623b93a9c97e344679cbffe656e59cc9a6e1fa893dfb540df6c56e504dc993f |
|
MD5 | ed26d9646e1f61247d68613a4f44f147 |
|
BLAKE2b-256 | ece6e24e95e37bae0a14dc7a2b7823914d78e6a51413add65536b2a48cb61149 |
File details
Details for the file abcd_graph-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: abcd_graph-0.1.0-py3-none-any.whl
- Upload date:
- Size: 19.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.2 CPython/3.8.13 Linux/6.5.0-35-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d989acc71fcb85c49339ffc24289d32526b838caab02ea5c67ec4995c18c99f9 |
|
MD5 | a9c192e16acc8b7d80ff7016f1fec1bd |
|
BLAKE2b-256 | 442b2d18a955acfae504eacd68a64255682ad98c06526fc99d9f2f64733fb97a |