-
Notifications
You must be signed in to change notification settings - Fork 7
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
Partial coloring of the GO graph #5
Comments
Ah, that's one of the modifications I designed but never programmed. GOs node colors are AFAIK never even read in the first place, in # set possible colors per node
for node in self.GO.nodes():
self._values_per_node[node] = self._all_colors.copy() Changing that should not take long. What annoys me is, that there currently is no interface to change while it runs / change the allowed isomorphisms. |
According to my notes from 2 years back I also needed to change the constraint propagation -> done. @asher-pembroke, I created a new branch, (did not test it enough to release), if you could check it out, that would be great ( I tried the following code import networkx as nx
import graphwfc
GI = nx.Graph([(1,2),(2,3),(3,4)])
GI.add_nodes_from([(1,{'c':'b'}),(2,{'c':'b'}),(3,{'c':'r'}),(4,{'c':'y'})])
GL = nx.Graph([(1,2)])
GO = nx.random_tree(40)
leaves = [x for x in GO.nodes() if GO.degree(x)==1]
for n in leaves:
GO.add_node(n, c='b')
S = graphwfc.GraphWFCState(GO=GO,GLs=[GL],GI=GI,node_attr='c')
while not S.run():
S.reset()
import matplotlib.pyplot as plt
colors = list(nx.get_node_attributes(S.GO,'c').values())
nx.draw(S.GO, node_color=colors, node_size=100)
plt.show() |
Note to self: changing |
Hey,
Not sure if this is what you mean, but I'm trying to restrict a node's initial coloring to a subset of the available ones. I tried to specify a list for that node's color attribute, but that raises |
What I meant was, you call Currently I create a set with the one element given as the color attribute -> setting multiple would not work. |
Updated the code; import networkx as nx
import graphwfc
GI = nx.Graph([(1,2),(2,3),(3,4)])
GI.add_nodes_from([(1,{'c':'b'}),(2,{'c':'b'}),(3,{'c':'r'}),(4,{'c':'y'})])
GL = nx.Graph([(1,2)])
GO = nx.random_tree(40)
leaves = [x for x in GO.nodes() if GO.degree(x)==1]
for n in leaves:
GO.add_node(n, c=('r','y'))
S = graphwfc.GraphWFCState(GO=GO,GLs=[GL],GI=GI,node_attr='c')
while not S.run():
S.reset()
import matplotlib.pyplot as plt
colors = list(nx.get_node_attributes(S.GO,'c').values())
nx.draw(S.GO, node_color=colors, node_size=100)
plt.show() as we override the attributes in GO, you should get the values back with |
Is there a way to initialize a few nodes of the output graph? I'm trying to propagate known colors for some of the nodes, but my output graph appears to ignore them. If need be I'll post some example code.
The text was updated successfully, but these errors were encountered: