If you are dealing with a classification problem, the TAN algorithm (tree augmented network) is a good choice. If you want to build a "generic" structure, there are other methods, such as the K2 algorithm. Anyway, both TAN and K2 do not generate an optimal network, since this is an NP-hard problem. Instead, they constitute heuristics to generate a "good" (optimized) structure.