man Graph::BitMatrix () - create and manipulate a V x V bit matrix of graph G

NAME

Graph::BitMatrix - create and manipulate a V x V bit matrix of graph G

SYNOPSIS

    use Graph::BitMatrix;
    use Graph::Directed;
    my $g  = Graph::Directed->new;
    $g->add_...(); # build $g
    my $m = Graph::BitMatrix->new($g, %opt);
    $m->get($u, $v)
    $m->set($u, $v)
    $m->unset($u, $v)
    $m->get_row($u, $v1, $v2, ..., $vn)
    $m->set_row($u, $v1, $v2, ..., $vn)
    $m->unset_row($u, $v1, $v2, ..., $vn)
    $a->vertices()

DESCRIPTION

This class enables creating bit matrices that compactly describe the connected of the graphs.

Class Methods

new($g)
Create a bit matrix from a Graph CW$g. The CW%opt, if present, can have the following options:
*
connect_edges If true or if not present, set the bits in the bit matrix that correspond to edges. If false, do not set any bits. In either case the bit matrix of V x V bits is allocated.

Object Methods

Return true if the bit matrix has a one bit between the vertices CW$u and CW$v; in other words, if there is (at least one) a vertex going from CW$u to CW$v. If there is no vertex and therefore a zero bit, return false. Set the bit between the vertices CW$u and CW$v; in other words, connect the vertices CW$u and CW$v by an edge. The change does not get mirrored back to the original graph. Returns nothing. Unset the bit between the vertices CW$u and CW$v; in other words, disconnect the vertices CW$u and CW$v by an edge. The change does not get mirrored back to the original graph. Returns nothing. Test the row at vertex CWu for the vertices CWv1, CWv2, ..., CWvn Returns a list of n truth values. Sets the row at vertex CWu for the vertices CWv1, CWv2, ..., CWvn, in other words, connects the vertex CWu to the vertices CWvi. The changes do not get mirrored back to the original graph. Returns nothing. Unsets the row at vertex CWu for the vertices CWv1, CWv2, ..., CWvn, in other words, disconnects the vertex CWu from the vertices CWvi. The changes do not get mirrored back to the original graph. Returns nothing.

vertices
Return the list of vertices in the bit matrix.

ALGORITHM

The algorithm used to create the matrix is two nested loops, which is O(V**2) in time, and the returned matrices are O(V**2) in space.

AUTHOR AND COPYRIGHT

Jarkko Hietaniemi jhi@iki.fi

LICENSE

This module is licensed under the same terms as Perl itself.