This is a project at my university in the graphs discipline, the project graphy is used for graphs functions using python.
This project is compatible with python3.6
Currently, this project has these graphs methods:
- Directed Matrix
- Not directed Matrix
- List adjacency directed
- Search Vertex
- List adjacency not directed
- Eulerian open or closed
- Depth First Search (DFS)
- Breadth First Search (BFS)
- Connected Components
- Transitive Closing
- Warshall Algorithm: Transitive Closure
- Topological Sorting
- ?
To install, run: pip install -r requirements.txt
will be installed, pytest, unittest and coverage.
This project creates a graph using adjacency array and adjacency list.
For creating a graph is necessary to initialize a class graph = Graph()
, a project can use graph directed and not directed using array or list.
Create a graph using an array is instanced graph = Graph(True, *)
and graph using adjacency list is instanced graph = Graph(False,*)
.
You can create a graph directed and not directed. For a graph directed using an array graph = Graph(True, True)
, for a graph directed using a list graph = Graph(False, True)
, also create a graph not directed using an array graph = Graph(True, False)
or list graph = Graph(False, False)
.
For create a vertex is necessary to initialize a graph, let's create a graph not directed using an array for example:
graph = Graph(True, False)
a = Vertex(0)
b = Vertex(1)
For create an array is necessary to have created vertex, after created the vertex, initialize a graph using graph.create_array()
.
Important to know: if you to use adjacency list not necessary initialize the list because when creating a graph is initialized automatically an adjacency list by default.
- Adjacency Array
graph = Graph(True, False)
a = Vertex(0)
b = Vertex(1)
graph.create_array()
- Adjacency List
graph = Graph(True, False)
a = Vertex(0)
b = Vertex(1)
Create an edge is necessary to have initialized a graph, use the graph.add_edge(a, a)
for create an edge.
graph = Graph(True, False)
a = Vertex(0)
b = Vertex(1)
graph.create_array()
graph.add_edge(a, a)
graph.add_edge(b, b)
To know how each method is working use the __doc__
command to know the documentation of each method. An example of using print(graph.add_edg .__ doc__)
, so documentation of that method can be read via command line.
The test will run locally.
To run the unit test pytest test/test_core.py
.
To run the coverage coverage run -m pytest
this will generate a .coverage file, then run coverage report
.
Everyone interacting in the graphy project's codebases is expected to follow the code of conduct.
If you want to contribute to adding other features, follow the instruction in contributing.
GPLv3