Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drawing a factor graph - invisible when edge weight is None #1756

Open
tillwenke opened this issue May 5, 2024 · 1 comment
Open

Drawing a factor graph - invisible when edge weight is None #1756

tillwenke opened this issue May 5, 2024 · 1 comment
Labels

Comments

@tillwenke
Copy link
Contributor

tillwenke commented May 5, 2024

Subject of the issue


G = FactorGraph()

G.add_nodes_from(['a', 'b', 'c'])

phi1 = DiscreteFactor(['a', 'b'], [2, 2], np.random.rand(4))

G.add_nodes_from([phi1])

G.add_edge('a', phi1)

nx.draw(Fg)
plt.show()

the graph is not drawn

when G.add_edge('a', phi1, weight=0)

it gets drawn.

Your environment

  • 0.1.25
  • 3.10

Expected behaviour

The graph should be drawable without explicitly setting a weight.

@ankurankan
Copy link
Member

@tillwenke This seems to stemming from the recent release of networkx where the default weight value of edges seem to have been changed. I think a potential quick fix in our code could be to by default add weight=0 argument when calling networkx's add_edge method.

@ankurankan ankurankan added the Bug label May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants