1Graph::BitMatrix(3)   User Contributed Perl Documentation  Graph::BitMatrix(3)
2
3
4

NAME

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

SYNOPSIS

9           use Graph::BitMatrix;
10           use Graph::Directed;
11           my $g  = Graph::Directed->new;
12           $g->add_...(); # build $g
13           my $m = Graph::BitMatrix->new($g, %opt);
14           $m->get($u, $v)
15           $m->set($u, $v)
16           $m->unset($u, $v)
17           $m->get_row($u, $v1, $v2, ..., $vn)
18           $m->set_row($u, $v1, $v2, ..., $vn)
19           $m->unset_row($u, $v1, $v2, ..., $vn)
20           $a->vertices()
21

DESCRIPTION

23       This class enables creating bit matrices that compactly describe the
24       connected of the graphs.
25
26   Class Methods
27       new($g)
28           Create a bit matrix from a Graph $g.  The %opt, if present, can
29           have the following options:
30
31           ยท       connect_edges
32
33                   If true or if not present, set the bits in the bit matrix
34                   that correspond to edges.  If false, do not set any bits.
35                   In either case the bit matrix of V x V bits is allocated.
36
37   Object Methods
38       get($u, $v)
39           Return true if the bit matrix has a "one bit" between the vertices
40           $u and $v; in other words, if there is (at least one) a vertex
41           going from $u to $v.  If there is no vertex and therefore a "zero
42           bit", return false.
43
44       set($u, $v)
45           Set the bit between the vertices $u and $v; in other words, connect
46           the vertices $u and $v by an edge.  The change does not get
47           mirrored back to the original graph.  Returns nothing.
48
49       unset($u, $v)
50           Unset the bit between the vertices $u and $v; in other words,
51           disconnect the vertices $u and $v by an edge.  The change does not
52           get mirrored back to the original graph.  Returns nothing.
53
54       get_row($u, $v1, $v2, ..., $vn)
55           Test the row at vertex "u" for the vertices "v1", "v2", ..., "vn"
56           Returns a list of n truth values.
57
58       set_row($u, $v1, $v2, ..., $vn)
59           Sets the row at vertex "u" for the vertices "v1", "v2", ..., "vn",
60           in other words, connects the vertex "u" to the vertices "vi".  The
61           changes do not get mirrored back to the original graph.  Returns
62           nothing.
63
64       unset_row($u, $v1, $v2, ..., $vn)
65           Unsets the row at vertex "u" for the vertices "v1", "v2", ...,
66           "vn", in other words, disconnects the vertex "u" from the vertices
67           "vi".  The changes do not get mirrored back to the original graph.
68           Returns nothing.
69
70       vertices
71           Return the list of vertices in the bit matrix.
72

ALGORITHM

74       The algorithm used to create the matrix is two nested loops, which is
75       O(V**2) in time, and the returned matrices are O(V**2) in space.
76
78       Jarkko Hietaniemi jhi@iki.fi
79

LICENSE

81       This module is licensed under the same terms as Perl itself.
82
83
84
85perl v5.30.0                      2019-07-26               Graph::BitMatrix(3)
Impressum