Skip to content

Implementation of a directed multigraph permitting loops

Notifications You must be signed in to change notification settings

Logogistiks/Graph-Engine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Graph Engine

Implementation of management and visualisation of directed multigraphs permitting loops

random


Usage

Use the Node() class to create multiple Nodes indentifiable via value.

node0 = Node(value=0)
node1 = Node(value=1)
node2 = Node(value=2)

You can assign parent and child nodes directly on creation of a node or later with the Node().register_parent() or Node().register_child() functions.

node3 = Node(value=3, parents=[node0])
node1.register_parent(node0)
node1.register_child(node2)

To print the parents of children of a node, use the Node().print_parents() or Node().print_childs() functions.

node1.print_parents()
node1.print_childs()

Get the whole graph a node is connected to with the get_graph(node) function.

my_graph = get_graph(node0)

Draw the graph by using the draw() function.

draw(my_graph)

example



Or just generate a random graph with the generate_graph() function where
n is the number of nodes
tweak is a value to tweak the number of parents and childs each node should have

my_graph2 = generate_graph(n=10, tweak=6)

About

Implementation of a directed multigraph permitting loops

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages