Structure learning of Bayesian networks

Ah, I see. I haven’t thought about it, but adjacency matrices may be one way. My problem is essentially: I have 2 bayesian networks (DAGs) with all continuous variables. I want to start coupling them by creating an edge (and a corresponding gaussian probability distribution) between say node a1 of DAG1 and node a2 of DAG2. But the choice of a1 and a2 is arbitrary. So eventually, I want to be able to form all possible connections between nodes of the DAGs and optimize the inter-connection topology given observations at one or more nodes of one or both DAGs (the topology of the DAGs themselves may remain constant reducing the search space of overall graph topology a little).