lamelizard / GraphWaveFunctionCollapse

WaveFunctionCollapse on graphs
MIT License
58 stars 7 forks source link

Some sort of examples would be great #1

Open alexpyattaev opened 5 years ago

alexpyattaev commented 5 years ago

Hi! Would it be possible to get some kind of guide (in English) for how to actually work with the code?

While one has to appreciate the fact it is uploaded, it is fairly impossible to figure out how to use it properly. For example, how does one make "spherical planet" sort of graph?

Thanks!

lamelizard commented 5 years ago

Sure, question is, what you want to do.

If you just want to try it out the recommended way is to create a folder with GI.graphml (colored), GL.graphml and GO.graphml and then run it in bash/cmd as described in the usage section.

If you want to integrate it or just run it from python then hopfully the run method is enough. If my code example and the documentation are too rudimentary (because they are) then ask ahead what you want to do.

If your question is how to get graphs, well... that's case by case, I created mine with custom python code; beach and starcave are based on pictures (that's why the beach is tilted that way). I loaded a picture that I drew and created the graph from that (pixel = node). maze was created in an voxel editor (maze_in.vox) and then I loaded that into python and did it analogously to the picture case. atlas (sphere planet) was done in Blender. I copied the networkx and graphwfc libraries into Blender's python folders. Then I created a sphere in blender and used their scripting environment to convert it into a graph and then to color the sphere according to the output graph. If you want to deal with bad code that was meant for private use only, I can upload my files for creating graphs here.

Hopefully that answered your question, if not ask ahead. However, depending on the complexity of the problem the answer might have to wait until my exams are finished (mid October).

asher-pembroke commented 3 years ago

I tried to run the code in the readme:

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.DiGraph([(1,2)])
GO = nx.random_tree(1000)

But it raises the following networkx error: AttributeError: 'Graph' object has no attribute 'pred'

I'm using networkx==2.5

lamelizard commented 3 years ago

@asher-pembroke, I moved your topic to the new issue.

asher-pembroke commented 3 years ago

@alexpyattaev #3 Shows a sample visualization in matplotlib. Take a gander!