How are bayesian networks created from an attribute matrix and target vector?

I'm very familiar with correlation networks but I can't seem to grasp my head around how Bayesian Networks are constructed.

How are the "edges" determined? How is the structure determined? I was speaking to somebody the other day who gave a lecture on Bayesian networks and he mentioned they are built one-node at a time instead of fully-connected correlation networks that are essentially created from a symmetric pairwise correlation matrix.

I'm experimenting with the concept using the iris dataset just to understand how these methods can be approached.

How are nodes connected in a Bayesian network? Can they be connected to categorical nodes as well (e.g. species from y_iris)?

Has anyone seen any implementations in Python with NetworkX that could help me understand how these could be created from real data? R could be useful too but I'm less familiar with R.