simple graph made up of vetices and edges.
the difference btween simple unweighted graph to weighted graph
is that each edge on a weight graph has weight wich is a positive number.
the difference between directed graph to simple undirected graph is that
each edge in direceted graph has a direction.
edge between node 1 and node 2 is NOT equals to edge between node 2 to node 1.
you can find much more information about directed graph here
- Low Complexity
- Support more than one mil verteices and ten mil edges
- each public class has tests
- support algorithms like Dijkstra's and Bfs
- each un-trivail metohd attached with explanations
- support ploting the graph and create randomly positions
- quick access to nodes/edges
To see the comparison with other graphs click here
add node into the graph : add_node(, )
connect two nodes with a weight: add_edge(
This class supports few algorithms like dfs tarjan and dijkstra's
it allows to save the graph into a json format and load a graph from json format
the dfs and tarjan algo used to find out if this graph is strongly connected and the connected commponents
methods:
- connected_components: return all the strongly connected commponents in the graph
what is strongly connected graph ?
it means there is a path from each node in the graph to every other node
for example:
this graph is Not strongly connected
this graph is strongly connected
for more information about strongly connected graph : click here
dijkstra's algorithm used in the methods shortest_path
-
Shortest path: return the shortest path between two nodes in the graph and the length of the path.
the shortest path will be the path with the minimalist edges weight
for example :
the shortest path from node 1 to 2 is : 1---> 3--->2 -
plot_garph: plot the graph - if the vertices has no positions the will be places in randomly (elegant)
example: