dominance_frontiers

dominance_frontiers#

graph_tool.structure.dominance_frontiers(g, root)[git][source]#

Return the dominance frontier of every vertex of a directed graph.

Parameters:
gGraph

Directed graph.

rootVertex or int

Entry vertex.

Returns:
dfVertexPropertyMap

Vector-valued vertex property map with the frontier of every vertex.

See also

dominator_tree

Immediate dominator of every vertex

Notes

A vertex \(u\) dominates \(v\) if every path from the root to \(v\) passes through \(u\) (every vertex dominates itself), and strictly dominates it if, in addition, \(u \ne v\). The dominance frontier of \(u\) is the set of vertices \(v\) such that \(u\) dominates a predecessor (in-neighbor) of \(v\) but does not strictly dominate \(v\) (see dominator_tree()); it gives the placement of \(\phi\)-functions in static single-assignment form [cytron-efficiently-1991]. It is computed from the dominator tree by walking up from the predecessors of every vertex with two or more of them [cooper-simple-2001], in time \(O(E + \sum |DF|)\).

References

[cytron-efficiently-1991]

Ron Cytron, Jeanne Ferrante, Barry K. Rosen, Mark N. Wegman and F. Kenneth Zadeck, “Efficiently computing static single assignment form and the control dependence graph”, ACM Transactions on Programming Languages and Systems 13, 451-490 (1991), DOI: 10.1145/115372.115320 [sci-hub, @tor]

[cooper-simple-2001]

Keith D. Cooper, Timothy J. Harvey and Ken Kennedy, “A simple, fast dominance algorithm”, Software Practice and Experience 4, 1-10 (2001).

Examples

>>> g = gt.Graph([(0, 1), (1, 2), (1, 3), (2, 4), (3, 4), (4, 5)])
>>> df = gt.dominance_frontiers(g, 0)
>>> print([list(df[v]) for v in g.vertices()])
[[], [], [4], [4], [], []]