A python 3.x package to color a graph based on patterns extracted from an colored example graph. This algorithm is based on WaveFunctionCollapse.
THIS FILE IS UNDER CONSTRUCTION
Install with
python setup.py install After installing you can run an example by going into the directory (e.g. /examples/beach) and calling
python python -m graphwfc -v value All examples use the attribute 'value' as color.
An autogenerated documenation is available.
Example Code
import networkx as nx import graphwfc GI = nx.Graph([(1,2),(2,3),(3,4)]) GI.add_nodes_from([(1,{'c':1}),(2,{'c':1}),(3,{'c':2}),(4,{'c':3})]) GL = nx.Graph([(1,2)]) GO = nx.random_tree(1000) S = graphwfc.GraphWFCState(GO=GO,GLs=[GL],GI=GI,node_attr='c') while not S.run(): S.reset() nx.write_graphml(S.GO, "out.graphml")undirected Graphs are nearly untested. Since edges are only used to get subgraph isomorphisms this should be fine.