Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.6 / 3....
  • Linux Kernel 3.0.82 LTS...
  • KDE Software Compilatio...
  • PulseAudio 4.0
  • Wireshark 1.10.0
  • NetworkManager 0.9.8.2
  • LibreOffice 3.6.6 / 4.0...
  • SystemRescueCd 3.7.0
  • Linux Kernel 3.10 RC6
  • Ubuntu Tweak 0.8.5
  • Home > Linux > Programming > Libraries

    digraphtools 0.2.1

    Download button

    No screenshots available
    Downloads: 127  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    David Basden | More programs
    BSD License / FREE
    September 9th, 2011, 10:15 GMT
    ROOT / Programming / Libraries

     Read user reviews (0)  Refer to a friend  Subscribe

    digraphtools description

    Some tools for working with digraphs, partial orders and topological sorting with Python

    digraphtools provides some tools for working with directed acyclic graphs, partial orders and topological sorting with Python.

    digraphtools was written as a lightweight way of using DAGs and partial ordering to represent, sort and traverse dependency trees in a lightweight way.

    The code is hosted on github at https://github.com/dbasden/python-digraphtools.

    Graph Representation

    Graphs

    A graph is represented as a dict which maps a node to a list nodes connected via the outgoing edges of that node.

    e.g.

     graph = { 1: [2,3],
     2: [3], 3: [] }


    is a DAG represented by the edges (1,2) (1,3) (2,3) where the edge 2tuple is in the form of (from,to).

    There are helper methods in deptools to generate graphs from a list of edges, and vice versa.

    Binary relations

    If a DAG represents dependencies, e.g. the edge (1,2) is taken to mean "1 depends on 2", this is backwards from a binary relation. (1,2) would be the relation 2P1.

    Topological Sorting

    There are two ways of generating linear extensions / topological sorts of dependencies (i.e. orders items must be processed in to satisfy dependency requirements):

    deptools.dfs_topsort_traversal

    deptools.dfs_topsort_traversal will take a graph and iterate over a single valid topologicaly sorted order

    deptools.topsort.vr_topsort

    deptools.topsort.vr_topsort will generate all valid linear extensions / topological orderings given an initial 'seed' linear extension (such as the one generated by deptools.dfs_topsort_traversal).

    The method does not take the graph format as used by deptools as input, but it does have a helper method to generate it's input matrix from a partial order set (which can be generated from a graph using helpers in deptools).

    See the examples in topsort.py and test/test_topsort.py for how to do this.


    Product's homepage

    Requirements:

    · Python

      


    TAGS:

    acyclic graphs | topological sorting | acyclic | graphs | digraphs

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM