Finding cycles and Graph::Base

Ask a Question related to PERL Modules, Design and Development.

  1. #1

    Default Re: Finding cycles and Graph::Base

    William Goedicke <goedicke@goedsole.com> wrote:
    > Dear Y'all -
    >
    > Has anybody come up with a way of finding cycles in graphs created
    > with Graph::Base?
    I don't know Graph::Base specifically, but an easy way to find
    cycles, if performance isn't a huge concern, is:


    foreach $e (edge()) {
    my ($v1,$v2)=get_vertices($e);
    delete($e);
    if (is_path($v1,$v2)) {
    restore($e);
    edge_is_in_cycle($e);
    }
    else {
    restore($e);
    };
    };

    --
    -------------------- [url]http://NewsReader.Com/[/url] --------------------
    Usenet Newsgroup Service New Rate! $9.95/Month 50GB
    ctcgag@hotmail.com Guest

  2. Similar Questions and Discussions

    1. Graph.0.69 Module---how to get a DAG from graph with cycles
      Here I use an example to illustrate the problem I met when using Graph Theory Module: I have a directed graph looks like the following (see the...
    2. How to add a trendline in a bar graph
      Hi spuyear Have you been able to find a solution to your query ? Prayank
    3. GD::Graph - how to get rid of leading gap in line graph?
      Is there a way to get rid of the leading gap to the left of a line graph? Therefore, I want the graph line to start on the Y-axis, not the...
    4. ANNOUNCE: Graph::Timeline and Graph::Timeline::GD 1.0
      Graph::Timeline - Render timeline data This document refers to verion 0.1 of Graph::Timeline, released November 11, 2003 This class takes a...
    5. Web graph ?????
      I've a couple of tricks to generate bar charts on the fly, using GD in one instance, and spacer images/TD cells in the other Using GD /...
  3. #2

    Default Re: Finding cycles and Graph::Base

    William Goedicke <goedicke@goedsole.com> wrote:
    > Dear Y'all -
    >
    > Has anybody come up with a way of finding cycles in graphs created
    > with Graph::Base?
    I don't know Graph::Base specifically, but an easy way to find
    cycles, if performance isn't a huge concern, is:


    foreach $e (edge()) {
    my ($v1,$v2)=get_vertices($e);
    delete($e);
    if (is_path($v1,$v2)) {
    restore($e);
    edge_is_in_cycle($e);
    }
    else {
    restore($e);
    };
    };

    --
    -------------------- [url]http://NewsReader.Com/[/url] --------------------
    Usenet Newsgroup Service New Rate! $9.95/Month 50GB
    ctcgag@hotmail.com Guest

  4. #3

    Default Re: Finding cycles and Graph::Base

    [email]ctcgag@hotmail.com[/email] wrote:
    > William Goedicke <goedicke@goedsole.com> wrote:
    > > Dear Y'all -
    > >
    > > Has anybody come up with a way of finding cycles in graphs created
    > > with Graph::Base?
    >
    > I don't know Graph::Base specifically, but an easy way to find
    > cycles, if performance isn't a huge concern, is:
    Maybe I should clarify, the below-used subs are just names I made
    up to describe the necessary funtionality, not actually existing subs
    in any package I know of (and is_path() would have been better called
    are_connected()). Although I suspect all of the functionality
    would be available in some way or another through Graph::Base.
    >
    > foreach $e (edge()) {
    > my ($v1,$v2)=get_vertices($e);
    > delete($e);
    > if (is_path($v1,$v2)) {
    > restore($e);
    > edge_is_in_cycle($e);
    > }
    > else {
    > restore($e);
    > };
    > };
    --
    -------------------- [url]http://NewsReader.Com/[/url] --------------------
    Usenet Newsgroup Service New Rate! $9.95/Month 50GB
    ctcgag@hotmail.com Guest

  5. #4

    Default Re: Finding cycles and Graph::Base

    [email]ctcgag@hotmail.com[/email] wrote:
    > William Goedicke <goedicke@goedsole.com> wrote:
    > > Dear Y'all -
    > >
    > > Has anybody come up with a way of finding cycles in graphs created
    > > with Graph::Base?
    >
    > I don't know Graph::Base specifically, but an easy way to find
    > cycles, if performance isn't a huge concern, is:
    Maybe I should clarify, the below-used subs are just names I made
    up to describe the necessary funtionality, not actually existing subs
    in any package I know of (and is_path() would have been better called
    are_connected()). Although I suspect all of the functionality
    would be available in some way or another through Graph::Base.
    >
    > foreach $e (edge()) {
    > my ($v1,$v2)=get_vertices($e);
    > delete($e);
    > if (is_path($v1,$v2)) {
    > restore($e);
    > edge_is_in_cycle($e);
    > }
    > else {
    > restore($e);
    > };
    > };
    --
    -------------------- [url]http://NewsReader.Com/[/url] --------------------
    Usenet Newsgroup Service New Rate! $9.95/Month 50GB
    ctcgag@hotmail.com Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139