EasyGraphLib
This is a simple package for working with graphs in Python 3.
Tasks:
- Add weighted graph.
- Add unweighted graph.
- Add tree's.
"class weighted_graph" methods:
-
add_node("node name", "connect or connections", "values for con/con's") - add node with connections and values
-
add_connections("node name", "connection or connections", "values for con/con's") - add connections.
-
update_connection("node name", "connection", "value") - update connection value.
-
remove_node("node name") - remove node with connections.
-
remove_connection("node name", "connection") - remove connection from node.
-
compile_graph() - Compile EasyGraphLib struct.
-
find_tnw_d("EasyGraphLib struct") - Dijkstra algorythm.
import easygraphlib as egl wg = egl.weighted_graph() # Creating weighted graph wg.add_node("start", ("a","b"), (6,2)) # Adding node with connections. wg.add_connections("start", "c", 3) # Adding connection. wg.add_node("c", ("a", "fin"), (2, 2)) wg.update_connection("start", "c", 4) # Update connection. wg.add_node("a", ("fin"), (1)) wg.add_node("b", ("a", "fin"), (3, 5)) wg.add_node("fin") # Node without connections. graph = wg.compile_graph() # Compile EasyGraphLib struct. print(graph, wg.find_tnw_d()) wg.remove_node("c") # Removing node. wg.remove_connection("b", "a") # Removing connection from node. graph = wg.compile_graph() # Compile EasyGraphLib struct. print(graph) # You can't use wg.find_tnw_d() with this graph.
"class unweighted_graph" methods:
-
add_node("node name", "connect or connections", "values for con/con's") - add node with connections and values
-
add_connections("node name", "connection or connections", "values for con/con's") - add connections.
-
update_connection("node name", "connection", "value") - update connection value.
-
remove_node("node name") - remove node with connections.
-
remove_connection("node name", "connection") - remove connection from node.
-
get_graph()
-
wide_search("node name", "value", "condition")
import easygraphlib as egl wg = egl.unweighted_graph() # Creating weighted graph wg.add_node("John", ("David","Mike"), (False, False)) # Adding node with connections. wg.add_connections("John", "Leonard", False) # Adding connection. wg.add_node("Leonard", ("David", "Josh"), (False, True)) wg.update_connection("Jonh", "Leonard", False) # Update connection. wg.add_node("David", ("Josh"), (True)) wg.add_node("Mike", ("David", "Josh"), (False, True)) graph = wg.get_graph() # Get graph. print(graph, wg.wide_search("David", True)) wg.remove_node("Leonard") # Removing node. wg.remove_connection("Mike", "David") # Removing connection from node. graph = wg.get_graph() # Compile EasyGraphLib struct. print(graph, wg.wide_search("Mike"))
Metadata
Release files for EasyGraphLib 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| EasyGraphLib-0.3.0.tar.gz | 4.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| EasyGraphLib-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.0 kB
Release files / EasyGraphLib-0.3.0.tar.gz
| Download URL | EasyGraphLib-0.3.0.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e384cdea37c6f7a9e6d3914e5c40024c04eb045e6571befa0540cbe6030b35ee
|
|
BLAKE2b-256 checksum How to use checksums |
0f30826e17cf1092a81f5769130e683b3d91b789245bab150e3d2199f398da08
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.5
|
Release files / EasyGraphLib-0.3.0-py3-none-any.whl
| Download URL | EasyGraphLib-0.3.0-py3-none-any.whl |
|---|---|
| Size | 5.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8128ecb8d88aad8cb9337ddcc0222cae53d0a823c9d548de316bb9b656ebebee
|
|
BLAKE2b-256 checksum How to use checksums |
a5bddf7f022adcf668bb992bd614da9ee2f68abfd83bbe8f8e15fa24aa6d6672
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.5
|