Cayley graph of a Boolean function
The boolean_cayley_graph
module defines
a function that contructs the Cayley graph of a Boolean function.
AUTHORS:
Paul Leopardi (2016-08-21): initial version
EXAMPLES:
sage: from boolean_cayley_graphs.boolean_cayley_graph import boolean_cayley_graph
sage: f = lambda n: (n // 2) % 2
sage: [f(i) for i in range(4)]
[0, 0, 1, 1]
sage: g = boolean_cayley_graph(2, f)
sage: g.adjacency_matrix()
[0 0 1 1]
[0 0 1 1]
[1 1 0 0]
[1 1 0 0]
REFERENCES:
Bernasconi and Codenotti [BC1999].
- boolean_cayley_graphs.boolean_cayley_graph.boolean_cayley_graph(dim, f)[source]
Construct the Cayley graph of a Boolean function.
Given the non-negative integer
dim
and the functionf
, a Boolean function that takes a non-negative integer argument, the functionBoolean_Cayley_graph
constructs the Cayley graph off
as a Boolean function on \(\mathbb{F}_2^{dim}\), with the lexicographica ordering. The valuef(0)
is assumed to be0
, so the graph is always simple.INPUT:
dim
– integer. The Boolean dimension of the given function.f
– function. A Boolean function expressed as a Python function taking non-negative integer arguments.
OUTPUT:
A
Graph
object representing the Cayley graph off
.EXAMPLES:
The Cayley graph of the function
f
where \(f(n) = n \mod 2\).sage: from boolean_cayley_graphs.boolean_cayley_graph import boolean_cayley_graph sage: f = lambda n: n % 2 sage: g = boolean_cayley_graph(2, f) sage: g.adjacency_matrix() [0 1 0 1] [1 0 1 0] [0 1 0 1] [1 0 1 0]