Skip to content

Commit 75562bd

Browse files
committed
part 1
1 parent 3d5e53b commit 75562bd

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed
8.06 KB
Loading
33.4 KB
Loading

examples/python_api_basic/basic.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import networkx as nx
2+
import graphwfc
3+
GI = nx.Graph([(1,2),(2,3),(3,4)])
4+
GI.add_nodes_from([(1,{'c':'b'}),(2,{'c':'b'}),(3,{'c':'r'}),(4,{'c':'y'})])
5+
GL = nx.Graph([(1,2)])
6+
GO = nx.random_tree(40)
7+
S = graphwfc.GraphWFCState(GO=GO,GLs=[GL],GI=GI,node_attr='c')
8+
while not S.run():
9+
S.reset()
10+
11+
import matplotlib.pyplot as plt
12+
colors = list(nx.get_node_attributes(S.GO,'c').values())
13+
nx.draw(S.GO, node_color=colors, node_size=200)
14+
plt.show()

0 commit comments

Comments
 (0)