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

to_nx output labelling #2

Open
ldobbelsteen opened this issue Oct 10, 2023 · 1 comment
Open

to_nx output labelling #2

ldobbelsteen opened this issue Oct 10, 2023 · 1 comment

Comments

@ldobbelsteen
Copy link

When outputting the graph to networkx using to_nx, the output labels are incorrect. They seem to all be using the label of the first output variant. The example below can be reproduced using the code below. I would expect the labels to be "x", "y" and "z" respectively, but they are not. How would I go about doing this?

from mdd import Interface
import aiger_bv as BV
import networkx as nx
from mdd.nx import to_nx

interface = Interface(
    inputs={
        "a": [0, 1, 2],
        "b": [0, 1, 2],
    },
    output=["x", "y", "z"]
)

func = interface.lift(BV.ite(
    interface.var("a").expr() == interface.var("a").encode(2),
    interface.output.expr() == interface.output.encode("x"),
    BV.ite(
        interface.var("b").expr() == interface.var("b").encode(2),
        interface.output.expr() == interface.output.encode("y"),
        interface.output.expr() == interface.output.encode("z"),
    )
))

graph = nx.nx_pydot.to_pydot(to_nx(func, symbolic_edges=False))
graph.write_pdf("test.pdf")

afbeelding

@mvcisback
Copy link
Owner

Hi @ldobbelsteen ,

This does seem to be an issue. I apologize.

Currently I don't have bandwidth to look into this, but if you find the root of this issue and I'm happy to look into resolving (or review a PR).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants