Skip to main content

Introduction

The simple-graph module contains basic functions for graph.

Concept

A graph is a structure to hold a set of objects in which some pairs of the objects are connected.

A graph contains two components: vertices and edges.

We consider both directed and undirected edges in this project. If the edges are undirected, the graph is called undirected graph, on the other hand, it is called directed 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(G.find_path('a', 'b'))
print(G.diameter())

output:

['a', 'c', 'b']
3

Check Wiki for more details.

Authors

qrcode_for_wechat_official_account

Release files for simple-graph 0.2.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for simple-graph 0.2.4
File Interpreter ABI Platform
simple_graph-0.2.4-py3-none-any.whl Python 3 none any Details

Release files / simple_graph-0.2.4-py3-none-any.whl

Download URL simple_graph-0.2.4-py3-none-any.whl
Size 9.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
63b6615d6affca237c12f2f62a81536ab06b2cc99835f137a98e71cec03b0ea3
BLAKE2b-256 checksum
How to use checksums
58f5a5e3fdd5449c6d7a6e2178cd4df4ef35d495e4ed2da7776525b173f3a671
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.5

Release history Release notifications | RSS feed

This release

0.2.4 This release

1 release file

0.2.3

1 release file

0.2.2

1 release file

0.2.1

1 release file

0.2.0

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page