Skip to content
Snippets Groups Projects
Commit b13d8265 authored by Lukas Kettenbach's avatar Lukas Kettenbach
Browse files

Important bug fix

parent 26ca6d7f
No related branches found
No related tags found
No related merge requests found
import sys
import networkx as nx
from primo.core import Node
......@@ -9,7 +7,10 @@ class BayesNet(object):
node_lookup = {}
def __init__(self):
pass
# This is IMPORTANT: without type() all children will have the same
# graph instance!
type(self).graph = nx.DiGraph()
type(self).node_lookup = {}
def add_node(self, node):
if isinstance(node, Node):
......@@ -83,6 +84,11 @@ class BayesNet(object):
import matplotlib.pyplot as plt
nx.draw_circular(self.graph)
plt.show()
def draw_graphviz(self):
import matplotlib.pyplot as plt
nx.draw_graphviz(self.graph)
plt.show()
def is_valid(self):
'''Check if graph structure is valid.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment