Graph._bfs_subgraph and back_bfs_subgraph return subgraphs with reversed edges

Issue #4 resolved
pombredanne NA
created an issue

If I call back_bfs_subgraph on a graph: A -> B -> C starting from C, the returned graph will be A <-- B <-- C . I would have expected no edge reversal and to get A -> B -> C

>>>import altgraph
>>> graph = altgraph.Graph.Graph()
>>> graph.add_node('A')
>>> graph.add_node('B')
>>> graph.add_node('C')
>>> graph.add_edge('A', 'B')
>>> graph.add_edge('B', 'C')
>>> ls = graph.forw_topo_sort()
>>> print(ls)
(True, ['A', 'B', 'C'])
>>> subgraph = graph.back_bfs_subgraph('C')
>>> ls = subgraph.forw_topo_sort()
>>> print(ls)
(True, ['C', 'B', 'A'])

Comments (3)

  1. Ronald Oussoren repo owner

    You've got a point there. This shows that I don't actually use this method myself :-(

    I'm trying to get a new release of py2app out this weekend and will merge your patch after that to avoid having to rerun my entire pre-release test plan.

  2. Log in to comment