Package visgraph :: Module graphcore :: Class HierarchicalGraph
[hide private]
[frames] | no frames]

Class HierarchicalGraph

source code

Graph --+
        |
       HierarchicalGraph

An extension to the graph base which implements the idea of hierarchy keeping a weight relationship based on the added edges. Edges are directional from X to y.

You must add nodes with the property "rootnode" to know where the hierarchy begins!

Instance Methods [hide private]
 
__init__(self) source code
 
getRootNodes(self)
Get all the node id's in this graph which are weight 0 (meaning they have no parents)...
source code
 
getNodeWeights(self)
Calculate the node weights for the given nodes in the hierarchical graph based on the added "rootnode" nodes.
source code
 
getPathCount(self)
Return the number of non-looped paths through this function.
source code

Inherited from Graph: addEdge, addNode, delEdge, delNode, getClusterGraphs, getEdge, getEdgeInfo, getEdges, getMeta, getNode, getNodeInfo, getNodeProps, getNodes, getRefsFrom, getRefsTo, hasNode, pathSearch, pathSearchFrom, pathSearchOne, setEdgeInfo, setMeta, setNodeInfo, wipeGraph

Method Details [hide private]

__init__(self)
(Constructor)

source code 
Overrides: Graph.__init__

getNodeWeights(self)

source code 

Calculate the node weights for the given nodes in the hierarchical graph based on the added "rootnode" nodes. This will return a dict of { nodeid: weight, } key-pairs.

# NOTE: This will also set the 'weight' property on the nodes

getPathCount(self)

source code 

Return the number of non-looped paths through this function.

NOTE: one small issue, "spiral" functions where the leaf node
      has a lower weight than a block which must reach it by a
      looped path will be a few total paths short...