Skip to main content

Python library for creating graphs, trees, and gemini structures.

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

EasyGraphLib-0.3.0.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

EasyGraphLib-0.3.0-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file EasyGraphLib-0.3.0.tar.gz.

File metadata

  • Download URL: EasyGraphLib-0.3.0.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for EasyGraphLib-0.3.0.tar.gz
Algorithm Hash digest
SHA256 e384cdea37c6f7a9e6d3914e5c40024c04eb045e6571befa0540cbe6030b35ee
MD5 0949e0608398894c077fade9c2448ff0
BLAKE2b-256 0f30826e17cf1092a81f5769130e683b3d91b789245bab150e3d2199f398da08

See more details on using hashes here.

File details

Details for the file EasyGraphLib-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: EasyGraphLib-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for EasyGraphLib-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8128ecb8d88aad8cb9337ddcc0222cae53d0a823c9d548de316bb9b656ebebee
MD5 09e0745d00a25aee9d61e60b91e417a1
BLAKE2b-256 a5bddf7f022adcf668bb992bd614da9ee2f68abfd83bbe8f8e15fa24aa6d6672

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page