Recursion relations: Coding a procedure to compute the number of planar rooted bipartite graphs

48 Views Asked by At

so I'm trying to come up with a procedure for maple to compute the number of planar, rooted bipartite graphs with k undirected edges using a particular recurrence relation from two generating functions.

Firstly, I have the relations for the red vertices of the graph in terms of the green vertices of the graph: $$R_{k+1}(q):=\sum_{j=1}^{k+1} qR_{j-1}(q)G_{k+1-j}(q)$$ and $$G_{k+1}(q):=\sum_{j=1}^{k+1} G_{j-1}(q) R_{k+1-j}(q)$$ where q is a placeholder with $G_0(q)=R_0(q) = 1$.
The generating functions are for red vertices, where r = #red vertices: $$R_k(q)= \sum_{\forall \Gamma \in D_{2k}}q^{r-1}$$ and for the $g$ green vertices in the graph.

$$ G_k(q) = \sum_{\forall \Gamma \in D_{2k}}q^g$$

$\Gamma \in D_{2k}$ is a rooted planar bipartite graph in the set of graphs in 1-1 correspondence with Dyck's paths of length $2k$ such that there are $k$ undirected edges in the graph.

My first attempt is not even worth the time to typeset to show you suffice it to say is that it is a more or less direct translation into maple's language. I've consumed the better part of the day trying to get this to work.

Suggestions are sought after and gratefully received.
Thanks.

2

There are 2 best solutions below

0
On BEST ANSWER

So, abandoning the attempt to make a recursive procedure, I simply put each step into a holding vector R, and G, and with a simple for loop, I got what was needed.

R[0] := 1; G[0] := 1;

for k to 11 do

R[k] := simplify(add(G[j-1] R[k-j], j = 1 .. k));

G[k] := simplify(add(q*R[j-1]*G[k-j], j = 1 .. k))

end do

And I got precisely what I needed. I was, as per usual, using a sledgehammer, when a pair of scissors was needed.

2
On

My approach to implementing this would be to go bottom up, storing all the intermediate values for easy reference, and computing next ones with summation. How large $k$ do you need?

For faster reference, I would cache the first 200-300 values for each array before computing anything else...