This repository contain some functions for manipulating graphs objects.
The librairy now contain the following files :
-
vect.py
: Contains primitives for the treatment of vectors and matrices (with python's lists) -
basicsNO.py
: Contains basics functions to manipulate non oriented graphsnbSommets(G)
Return the number of nodes from G graphnbArete(G)
Return the number of edges from G graphajouteArete(G, i, j)
Add an edge between nodes i and j in G graphenleveArete(G, i, j)
Delete an edge between nodes i and j in G graphdeg(G, i)
Return i's degreedegre(G)
Return G degreelisteToMatrice(G)
Transform adjacency list in adjacency matrixnonOriente(G)
Verify adjacency list symetry (to verify if G is non-oriented)kuratowski(n)
Return adjacency list Vector from the n'th Kuratowski graphareteToListe(n, L)
Transform edges list in adjacency listmatriceToListe(M)
Transform adjacency matrix in adjacency listsousG(G,i)
Return a copy of G without i
-
basicsO.py
: Contains basics functions to manipulate oriented graphsnbSommets(G)
Return the number of nodes from G graphnbArcs(G)
Return the number of edges from G graphajouteArc(G, i, j)
Add an edge between nodes i and j in G graphenleveArc(G, i, j)
Delete an edge between nodes i and j in G graphdegS(G, i)
Return i's out-degreedegreS(G)
Return G degreedegE(G, i)
Return i's in-degreelisteToMatrice(G)
Transform adjacency list in adjacency matrixvoisinage(G, i)
Return i's neighborhoodareteToListe(n, L)
Transform edges list in adjacency listmatToListe(M)
Transform adjacency matrix in adjacency list
-
BreadthFirstSearch.py
: Implement simple and generalized BF search in graphslargeur(G, i)
Return nodes visit list for the simple BF search from the i nodelargeurG(G)
Return nodes visit list for the generalized BF search
-
DepthFirstSearch.py
: Implement simple and generalized DF search in graphsprofRec(G, i, Visite, ordreVisite)
Recursive function that do a simple DF search from a node iprofond(G, i)
Return nodes visit list for the simple DF search from the i nodeprofondG(G)
Return nodes visit list for the generalized DF search
-
searchApplicationsNO.py
: Implement BF and DF applications in non oriented graphsisConnexe(G)
: Return true if G is connectedcyclicRec(G, pere, visite, cycle)
: Recursive cycles detection functionisCyclic(G)
: Return true if G have, at least, one cycleisArbre(G)
: Return true if G is a tree (connected graph without cycles)plusCourtChemin(G, i)
: Return the distance between node i and all others nodes in G, and the predecessor of each oneis_biparti(G)
: Return true if G is bipartite, false eitherTCC(G,i)
: Return the number of nodes in i's connected component
-
searchApplicationsO.py
: Implement BF and DF applications in oriented graphscyclicRec(G, i, Visite, cycle)
: Recursive Cycles detection functionisCyclic(G)
: Return true if G have one cycle or more
-
coloring.py
: Implement some coloring algorithmsmini(L)
: Return the smaller integer who's not in LcolorNaive(G)
: Implement naive coloring algorithmnoyau(L, G)
: Compute kernel of a graph GcolorGlouton(G)
: Implement greedy coloring algorithmcolorWP(G)
: Implement Welsh and Powell coloring algorithmis_valid(G, i, solution)
: Verify if neighborhood of i have different colorsbacktracking_rec(G, colors, i, solution, solutionList)
: Recursive backtracking functionbacktracking(G, colors=None)
: Implement Backtracking coloring algorithm
-
topologicalSort.py
: Implement topological and level sorting algorithmstriTopologique(G)
: Implement topological sortingtriNiveaux(G)
: Implement level sorting
-
MaxFlow.py
: Implement Ford-Fulkerson algorithm
This library was written by Nicolas Taffoureau.