A simple graph package
Project description
Introduction
The simple-graph module contains basic functions for graph.
License
simple-graph is a free software. See the file LICENSE for the full text.
Install
pip install simple-graph
or update
pip install --upgrade simple-graph
Usage
Basic operations
from simple_graph import Graph
G = Graph()
G.add_edge(1, 2)
print(G.has_edge(1, 2))
ouput:
True
G = Graph({0: [1, 2], 1: [2]})
print(G.neighbors(0))
output:
[1, 2]
Statistics
G = Graph({
"a" : ["c"],
"b" : ["c","e","f"],
"c" : ["a","b","d","e"],
"d" : ["c"],
"e" : ["b","c","f"],
"f" : ["b","e"]
})
print(graph.find_path('a', 'b'))
print(graph.diameter())
output:
['a', 'c', 'b']
3
Authors
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
simple_graph-0.1.0.tar.gz
(5.5 kB
view hashes)
Built Distribution
Close
Hashes for simple_graph-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fa5e1f85c192938c4cdee506a0176fb865edff678e3e309281085116a0dbb9d1 |
|
MD5 | fa552a986c2cca0cba2b74a76eaa2a7f |
|
BLAKE2b-256 | 242c6c7c3628e122ef2161615e073f0b63962b9bd2fc9f5d6e4b0e12c4d07d1c |