You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[](https://gitter.im/Encapsule/jsgraph?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
3
+
# Encapsule/jsgraph
4
4
5
-
## About jsgraph
5
+

6
6
7
7
_"... At the other end of the spectrum is, for example, graph theory, where the basic object, a graph, can be immediately comprehended. One will not get anywhere in graph theory by sitting in an armchair and trying to understand graphs better. Neither is it particularly necessary to read much of the literature before tackling a problem: it is of course helpful to be aware of some of the most important techniques, but the interesting problems tend to be open precisely because the established techniques cannot easily be applied."_ - [W.T. Gowers](https://en.wikipedia.org/wiki/Timothy_Gowers)
8
8
9
-
###Status
9
+
[](https://travis-ci.org/Encapsule/jsgraph)[](https://gitter.im/Encapsule/jsgraph?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
See also: [Mathematical Graph Theory](https://en.wikipedia.org/wiki/Graph_theory)
12
12
13
-
Ich danke Ihnen sehr [Travis CI](https://travis-ci.org/Encapsule/jsgraph.svg?branch=master)
13
+
## About jsgraph
14
14
15
15
### Summary
16
16
@@ -30,7 +30,7 @@ The library provides and normalizes the following operations independent of grap
30
30
31
31
### Audience
32
32
33
-
jsgraph is a framework for building next-generation frameworks on Node.js and HTML 5.
33
+
jsgraph is a framework for building next-generation frameworks on Node.js and HTML 5 applications:
34
34
35
35
- Use instead of in-memory object hierarchies linked by reference:
36
36
- Serializable to JSON (even when cyclic).
@@ -61,7 +61,7 @@ If you're considering using jsgraph in a commerical product, please get in touch
61
61
In your project, install via npm.
62
62
63
63
$ npm install jsgraph --save
64
-
jsgraph@0.6.xx node_modules/jsgraph
64
+
jsgraph@0.7.xx node_modules/jsgraph
65
65
66
66
### Sources
67
67
@@ -86,7 +86,7 @@ See also: [Encapsule/jsgraph on GitHub](https://github.com/Encapsule/jsgraph)
86
86
87
87
## Example
88
88
89
-
The following short example constructs a `DirectedGraph` container using a v0.6 jsgraph digraph data object, and derives a simple rank assignment algorithm from jsgraph's bundled `breadthFirstTraverse` algorithm. Note that the BFT visitor interface callback functions leverage the `DirectedGraph` API to get/set the data property value of each visited vertex to its rank.
89
+
The following short example constructs a `DirectedGraph` container using a v0.7 jsgraph digraph data object, and derives a simple rank assignment algorithm from jsgraph's bundled `breadthFirstTraverse` algorithm. Note that the BFT visitor interface callback functions leverage the `DirectedGraph` API to get/set the data property value of each visited vertex to its rank.
**v0.7 is a breaking API change and documentation release**
192
+
193
+
- Added new method `DirectedGraph.stringify`
194
+
- Changed method semantics of `DirectedGraph.toJSON` to return a serializable object instead of a JSON-encoded string.
195
+
- Alias method `DirectedGraph.toObject` to call `DirectedGraph.toJSON`. The `toObject` method is now deprecated and will be removed in a future release.
196
+
- Updated documentation:
197
+
- Per above breaking changes to the `DirectedGraph` serialization API.
198
+
- Added additional information on set/get of `DirectedGraph` name and description properties.
199
+
191
200
**v0.6 is a bug fix release that's API-compatible with v0.5**
192
201
193
202
- DFT algorithm bug fixes impacting order and identity of client visitor callbacks.
@@ -237,7 +246,7 @@ if (response.error) {
237
246
console.log(response.error);
238
247
} else {
239
248
digraph =response.result;
240
-
console.log(digraph.toJSON());
249
+
console.log(digraph.stringify());
241
250
}
242
251
```
243
252
@@ -287,8 +296,9 @@ The `DirectedGraph` container object created by this process models "a graph" ge
287
296
-`getRootVertices()` - retrieve an array of ID strings for all vertices that have in-degree zero
288
297
-`leafVerticesCount()` - obtain count of vertices with out-degree zero
289
298
-`getLeafVertices()` - retrieve an array of ID strings for all vertices that have out-degree zero
290
-
-`toObject()` - serialize the DirectedGraph container to a JavaScript data object
291
-
-`toJSON(replacer, space)` - serialize the DirectedGraph container to a JSON string
299
+
-`toObject()` - serialize the DirectedGraph container to a JavaScript data object (same as toJSON) **deprecated in v0.7**
300
+
-`toJSON()` - serialize the DirectedGraph container to a JavaScript data object (same as toObject)
301
+
-`stringify(replacer, space)` - serialize the DirectedGraph container to a JSON string
292
302
-`fromObject(dataObject)` - import a jsgraph-format JavaScript data object into the container (addative)
293
303
-`fromJSON(jsonString)` - import jsgraph-format JSON string into the container (addative)
294
304
@@ -349,7 +359,7 @@ A depth-first traversal concludes when all reacable vertices have been visited,
0 commit comments