simple_graph 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +9 -1
- data/docs/SimpleGraph/Graph/Node.html +497 -476
- data/docs/SimpleGraph/Graph.html +1160 -756
- data/docs/SimpleGraph.html +146 -126
- data/docs/_index.html +136 -136
- data/docs/class_list.html +51 -51
- data/docs/css/full_list.css +58 -58
- data/docs/css/style.css +492 -492
- data/docs/file.README.html +154 -146
- data/docs/file_list.html +56 -56
- data/docs/frames.html +17 -17
- data/docs/index.html +154 -146
- data/docs/js/app.js +248 -248
- data/docs/js/full_list.js +216 -216
- data/docs/js/jquery.js +3 -3
- data/docs/method_list.html +203 -163
- data/docs/top-level-namespace.html +109 -109
- data/lib/simple_graph/version.rb +2 -1
- data/lib/simple_graph.rb +60 -12
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e87715221bb60921ac6e47b6fa6efac9f7234ddd
|
4
|
+
data.tar.gz: e5380f1a8856e9e076dcf680919a531eafa43691
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55977cfed82c9ecdd1f781f2a071b8b68c6c39056a830a2db5eb6110f48673f8506f4f5d8848ee62a3fe5c0de1710be1524f65f94479cfb4fa4d9b3be8f7b668
|
7
|
+
data.tar.gz: 80fd775f88ef01d486be721d645a71715c0b5c707a9f29b677782b60acb11c70cad6c596ed4e7767687efe7dcce1847184b098debe59438cebefc75519dc54bb
|
data/README.md
CHANGED
@@ -54,16 +54,24 @@ bar = graph.add_node(id: "Igor", data: stuff)
|
|
54
54
|
graph.connect_nodes(foo, "Kevin")
|
55
55
|
|
56
56
|
# Paths between two nodes can be found by breadth-first search
|
57
|
-
# This method will return a array of arrays containing node IDs describing the path
|
58
57
|
paths = graph.find_paths(foo, bar)
|
59
58
|
|
60
59
|
# Retrieving info about the graph
|
60
|
+
graph.nodes # Lists all of the nodes in the graph
|
61
61
|
graph.node_count # Returns the amount of nodes in the graph
|
62
62
|
graph.node_ids # Array of node identifiers in the graph
|
63
|
+
graph.are_connected?(foo, bar) # Checks whether two nodes are connected by an Edge
|
64
|
+
graph.include?("Kevin") # Checks whether the graph includes a node with the given ID
|
63
65
|
|
64
66
|
# Graphs can be written to files in the DOT format to be used with Graphviz
|
65
67
|
# Note that the node ID will be used for labels
|
66
68
|
File.write("test.dot", graph.to_dot_string)
|
69
|
+
|
70
|
+
# Export a graph to a JSON file
|
71
|
+
File.write("output.json", graph.to_json)
|
72
|
+
|
73
|
+
# Import a graph from a JSON file
|
74
|
+
graph.load_from_json(File.read("input.json"))
|
67
75
|
```
|
68
76
|
|
69
77
|
## Contributing
|