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

ALGORITHM

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

LICENSE

83       This module is licensed under the same terms as Perl itself.
84
85
86
87perl v5.8.8                       2004-11-08               Graph::BitMatrix(3)
Impressum