NetworkX is an excellent library that implements graph representations and algorithms. Note is is not part of Python's standard library.
generate_random_tree.py
: illustration of how to use the NetworkX DiGraph class to represent a tree, generates a random tree according to specificationsadd_random_weights.py
: reads a GraphML representation of a tree, and addds random weights to the edgescompute_leaf_path_length.py
: compute the length of all paths from the tree's root to each of the leavespar_compute_leaf_length.py
: compute the length of all paths from the tree's root to each of the leaves, usesmultiprocessing
for parallel processinggraph.xml
: example GraphML representation of a treegraph.txt
: example edge list representation of a treeweighted_tree.xml
: example GraphML representation of a weighted treemax_flow.py
: illustration of the maximum flow algorithm on a very simple case of three parallel flows.shortest_path.ipynb
: Jupyter notebook illustrating the shortest path algorithm.