in reply to Re: connected component
in thread connected component

Representing graphs as edge sets is not sufficiently general, because edge sets alone cannot represent graphs that have isolated nodes. That's why the standard mathematical definition of a graph consists of both a set of nodes and a set of edges formed from nodes in the set of nodes.

the lowliest monk

Replies are listed 'Best First'.
Re^3: connected component
by water (Deacon) on May 15, 2005 at 09:39 UTC
    an inelegant cheesy solution, but I had this case covered by bogus self <-> self links, as shown by the test on 4 iso nodes, which return as 4 iso components.
    # resulting components <--- graph 'a|b|c|d' => [ [qw(a a)], [qw(b b)], [qw(c c)], [qw(d d)] ],
    again, a cheesy handrolled quick hack for what I needed, is all.