Graph.0.69 Module---how to get a DAG from....

S

Sean

I have a directed graph looks like the following (see the figure).
Edges in the original directed graph:
[main] -> [foo]; [main] -> [bar];
[foo] -> [trouble];
[trouble] -> [foo];

I want to find all the cycles. After I find a cycle, I want to break it
by deleting an edge starting a 'farther' vertice from node [main]---in
this case, deleting [trouble] -> [foo] to get the following graph
Edges after manipulation:
[main] -> [foo]; [main] -> [bar];
[foo] -> [trouble];
---------------------------------------------------------
[main]
/ \
[foo] [bar]
/ /
/ /
[trouble]
---------------------------------------------------------------

I tried to use @v = $g->connected_component_by_index($i), but it seems
to return single nodes (which is deemed as strongly connected component
itself), which is not what I want.
$g->find_a_cycle does not work either, because it returns same cycle no
matter how many times you call it.

I am newbie in perl. Can someone give me a suggestion how to utilize
the existing APIs in Graph.0.69?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top