in reply to Re: Finding number of 'k'-clique in a graph
in thread Finding number of 'k'-clique in a graph

Thanks so much for your reply, Monks.

To Ray Johnson, my code did'nt work because, I
forgot to change @V to @vertices and @E to @edges.

My further question to 'blokhead' is:
how can I store the output e.g:
5 6 9 2 3 4 1 3 4 1 2 4 1 2 3
into an array, with this snippet you've given
$regex .= '(?{ print join(" ", map $$_, 1..$k), "\\n" })(?!)'; $string =~ /$regex/x;
because when I used:
push @string, $string;
doesn't seems to work.

Regards,
Edward WIJAYA

Replies are listed 'Best First'.
Did it! - Storing cliques in array
by monkfan (Curate) on Sep 28, 2004 at 03:48 UTC
    Hi blokhead, I've managed, to stored it into an array by doing this:
    my @cliques = (); $regex .= '(?{ push (@cliques, join(" ", map $$_, 1..$k)) })(?!)'; $string =~ /$regex/x; print join("\n", @cliques), "\n";
    I just need to understand a bit on (?{}) part.
    Glad I learnt that.

    Thanks a again. for your kind suggestion. I will play around with your combinatorial subroutine. It seems easier to understand than Regex approach.

    BTW, thanks for the wonderful links you have on various CS items in your "monks home", I found it very useful.

    Gratefuly yours, Edward WIJAYA