A simple graph package

# 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.

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()
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

## Project details

Uploaded py3