Package portage :: Package util :: Module digraph :: Class digraph
[hide private]

Class digraph

source code

object --+
         |
        digraph

A directed graph object.

Instance Methods [hide private]
 
__init__(self)
Create an empty digraph
source code
 
add(self, node, parent, priority=0)
Adds the specified node with the specified parent.
source code
 
remove(self, node)
Removes the specified node from the digraph, also removing and ties to other nodes in the digraph.
source code
 
difference_update(self, t)
Remove all given nodes from node_set.
source code
 
remove_edge(self, child, parent)
Remove edge in the direction from child to parent.
source code
 
__iter__(self) source code
 
contains(self, node)
Checks if the digraph contains mynode
source code
 
get(self, key, default=None) source code
 
all_nodes(self)
Return a list of all nodes in the graph
source code
 
child_nodes(self, node, ignore_priority=None)
Return all children of the specified node
source code
 
parent_nodes(self, node, ignore_priority=None)
Return all parents of the specified node
source code
 
leaf_nodes(self, ignore_priority=None)
Return all nodes that have no children
source code
 
root_nodes(self, ignore_priority=None)
Return all nodes that have no parents.
source code
 
__bool__(self) source code
 
is_empty(self)
Checks if the digraph is empty
source code
 
clone(self) source code
 
delnode(self, node) source code
 
firstzero(self) source code
 
hasallzeros(self, ignore_priority=None) source code
 
debug_print(self) source code
 
bfs(self, start, ignore_priority=None) source code
 
shortest_path(self, start, end, ignore_priority=None) source code
 
get_cycles(self, ignore_priority=None, max_length=None)
Returns all cycles that have at most length 'max_length'.
source code
 
addnode(self, node, parent, priority=0)
Adds the specified node with the specified parent.
source code
 
allnodes(self)
Return a list of all nodes in the graph
source code
 
allzeros(self, ignore_priority=None)
Return all nodes that have no children
source code
 
hasnode(self, node)
Checks if the digraph contains mynode
source code
 
__contains__(self, node)
Checks if the digraph contains mynode
source code
 
empty(self)
Checks if the digraph is empty
source code
 
copy(self) source code
 
__nonzero__(self) source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

source code 

Create an empty digraph

Overrides: object.__init__

add(self, node, parent, priority=0)

source code 

Adds the specified node with the specified parent.

If the dep is a soft-dep and the node already has a hard relationship to the parent, the relationship is left as hard.

remove(self, node)

source code 

Removes the specified node from the digraph, also removing and ties to other nodes in the digraph. Raises KeyError if the node doesn't exist.

difference_update(self, t)

source code 

Remove all given nodes from node_set. This is more efficient than multiple calls to the remove() method.

remove_edge(self, child, parent)

source code 

Remove edge in the direction from child to parent. Note that it is possible for a remaining edge to exist in the opposite direction. Any endpoint vertices that become isolated will remain in the graph.

leaf_nodes(self, ignore_priority=None)

source code 

Return all nodes that have no children

If ignore_soft_deps is True, soft deps are not counted as children in calculations.

root_nodes(self, ignore_priority=None)

source code 

Return all nodes that have no parents.

If ignore_soft_deps is True, soft deps are not counted as parents in calculations.

get_cycles(self, ignore_priority=None, max_length=None)

source code 

Returns all cycles that have at most length 'max_length'. If 'max_length' is 'None', all cycles are returned.

addnode(self, node, parent, priority=0)

source code 

Adds the specified node with the specified parent.

If the dep is a soft-dep and the node already has a hard relationship to the parent, the relationship is left as hard.

allzeros(self, ignore_priority=None)

source code 

Return all nodes that have no children

If ignore_soft_deps is True, soft deps are not counted as children in calculations.