algorithm - If graph has cross edge, whether it is singly connected or not -
when "introduction algorithms 3rd", encounter question below.
22.3-13 * directed graph g singly connected if u -> v implies g contains @ 1 simple path u v vertices v . give efficient algorithm determine whether or not directed graph singly connected.
some of answer "run dfs once each vertex. graph singly connected if , if there no forward edges , there no cross edges"
but doubt situation. example, if edges of graph (a->d, d->e, e->a, b->c, c->a), dfs begin @ a, therefore c->a cross edge, think graph singly connected. sorry, can't upload picture because permission of stackoverflow.
there may cross edges in graph, there may cycle , graph single connected(sc). if have forward edge clear have 2 paths destination v. in condition if have cross edge graph not sc:: assume ab or zb our cross edge in graph, if there path between , z graph not sc,and if not have same path absolutely sc. if ab(or zb) our cross edge there should not path(s) between , z.
Comments
Post a Comment