Where is the data of the graph ?
bwhideaki opened this issue · comments
Hi !
I'm hideaki and this project is suprising !!
I want to know how to define the graph or how to load the data of graph.
Hello hideaki!
You can see the type definition for the graph struct in Graph.swift.
To create a graph, you simply provide a list of integer node IDs and edges:
let graph = Graph(
nodes: [1, 2, 3, 4, 5],
edges: [
Graph.Edge(nodes: [1, 2], weight: 1),
Graph.Edge(nodes: [2, 3], weight: 1),
Graph.Edge(nodes: [3, 4], weight: 1),
Graph.Edge(nodes: [4, 5], weight: 1),
Graph.Edge(nodes: [5, 1], weight: 1)
]
)
If you want to see more code examples, make sure to check out the demo project, that you can find in the GraphiteDemo directory in this repository. Most of the relevant code should be in the ViewController.swift file.
I hope I could help you.
Let me know if you have further questions.