Skip to main content

Colors a networkx (Di)Graph based on patterns extracted from an colored example (Di)Graph

Project description

# GraphWaveFunctionCollapse

A python 3.x package to color a graph based on patterns extracted from an colored example graph.
This algorithm is based on [WaveFunctionCollapse](https://github.com/mxgmn/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](https://lamelizard.github.io/GraphWaveFunctionCollapse/graphwfc.html) is available.

Example Code
```python
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")
```

# Remarks
undirected Graphs are nearly untested. Since edges are only used to get subgraph isomorphisms this _should_ be fine.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

GraphWFC-0.9.0.tar.gz (7.0 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page