Skip to content

Commit e11c07f

Browse files
authored
Merge pull request #52 from Encapsule/chrisrus/develop
Bug fixes to DirectedGraph serialization API
2 parents 208099a + db4106d commit e11c07f

40 files changed

+260
-194
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2014-2015 Christopher D. Russell
3+
Copyright (c) 2014-2016 Christopher D. Russell
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
# Encapsule/jsgraph
1+
![Encapsule.io](https://encapsule.io/images/blue-burst-encapsule.io-logo-251x64.png "Encapsule.io")
22

3-
[![Join the chat at https://gitter.im/Encapsule/jsgraph](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/Encapsule/jsgraph?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
3+
# Encapsule/jsgraph
44

5-
## About jsgraph
5+
![Begin at the beginning...](./docs/begin-at-the-beginning.jpg)
66

77
_"... 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)
88

9-
### Status
9+
[![Build Status](https://travis-ci.org/Encapsule/jsgraph.svg?branch=master)](https://travis-ci.org/Encapsule/jsgraph) [![Join the chat at https://gitter.im/Encapsule/jsgraph](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/Encapsule/jsgraph?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
1010

11-
[![Build Status](https://travis-ci.org/Encapsule/jsgraph.svg?branch=master)](https://travis-ci.org/Encapsule/jsgraph)
11+
See also: [Mathematical Graph Theory](https://en.wikipedia.org/wiki/Graph_theory)
1212

13-
Ich danke Ihnen sehr [Travis CI](https://travis-ci.org/Encapsule/jsgraph.svg?branch=master)
13+
## About jsgraph
1414

1515
### Summary
1616

@@ -30,7 +30,7 @@ The library provides and normalizes the following operations independent of grap
3030

3131
### Audience
3232

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:
3434

3535
- Use instead of in-memory object hierarchies linked by reference:
3636
- Serializable to JSON (even when cyclic).
@@ -61,7 +61,7 @@ If you're considering using jsgraph in a commerical product, please get in touch
6161
In your project, install via npm.
6262

6363
$ npm install jsgraph --save
64-
jsgraph@0.6.xx node_modules/jsgraph
64+
jsgraph@0.7.xx node_modules/jsgraph
6565

6666
### Sources
6767

@@ -86,7 +86,7 @@ See also: [Encapsule/jsgraph on GitHub](https://github.com/Encapsule/jsgraph)
8686

8787
## Example
8888

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.
9090
```javascript
9191
// Encapsule/jsgraph/examples/bft-vertex-ranking.js
9292
var jsgraph = require('jsgraph');
@@ -127,7 +127,7 @@ if (response.error) {
127127
throw new Error(response.error);
128128
}
129129
console.log("DirectedGraph: '" +
130-
digraph.toJSON(undefined,4) + "'");
130+
digraph.stringify(undefined,4) + "'");
131131
console.log("BFT traversal: '" +
132132
JSON.stringify(response.result,undefined,4) + "'");
133133
```
@@ -188,6 +188,15 @@ BFT traversal: '{
188188

189189
## Release
190190

191+
**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+
191200
**v0.6 is a bug fix release that's API-compatible with v0.5**
192201

193202
- DFT algorithm bug fixes impacting order and identity of client visitor callbacks.
@@ -237,7 +246,7 @@ if (response.error) {
237246
console.log(response.error);
238247
} else {
239248
digraph = response.result;
240-
console.log(digraph.toJSON());
249+
console.log(digraph.stringify());
241250
}
242251
```
243252

@@ -287,8 +296,9 @@ The `DirectedGraph` container object created by this process models "a graph" ge
287296
- `getRootVertices()` - retrieve an array of ID strings for all vertices that have in-degree zero
288297
- `leafVerticesCount()` - obtain count of vertices with out-degree zero
289298
- `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
292302
- `fromObject(dataObject)` - import a jsgraph-format JavaScript data object into the container (addative)
293303
- `fromJSON(jsonString)` - import jsgraph-format JSON string into the container (addative)
294304

@@ -349,7 +359,7 @@ A depth-first traversal concludes when all reacable vertices have been visited,
349359

350360
<hr>
351361

352-
Copyright &copy; 2014-2015 [Christopher D. Russell](https://github.com/ChrisRus)
362+
Copyright &copy; 2014-2016 [Christopher D. Russell](https://github.com/ChrisRus)
353363

354364

355365

docs/algorithm-bft.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,5 @@ finishVertex | { u: string, g: DirectedGraph } | invoked on a vertex after all o
4444

4545
<hr>
4646

47-
Copyright &copy; 2014-2015 [Christopher D. Russell](https://github.com/ChrisRus)
47+
Copyright &copy; 2014-2016 [Christopher D. Russell](https://github.com/ChrisRus)
4848

docs/algorithm-dft.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,5 @@ finishEdge | { e: { u: string, v: string }, g: DirectedGraph } | invoked on ea
4444

4545
<hr>
4646

47-
Copyright &copy; 2014-2015 [Christopher D. Russell](https://github.com/ChrisRus)
47+
Copyright &copy; 2014-2016 [Christopher D. Russell](https://github.com/ChrisRus)
4848

docs/algorithm-traversal.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,5 +120,5 @@ if (!response.error) {
120120

121121
<hr>
122122

123-
Copyright &copy; 2014-2015 [Christopher D. Russell](https://github.com/ChrisRus)
123+
Copyright &copy; 2014-2016 [Christopher D. Russell](https://github.com/ChrisRus)
124124

docs/example-dft.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,5 +122,5 @@ A simple JavaScript/jsgraph implementation of Depth-first search (DFS) example f
122122

123123
<hr>
124124

125-
Copyright &copy; 2014-2015 [Christopher D. Russell](https://github.com/ChrisRus)
125+
Copyright &copy; 2014-2016 [Christopher D. Russell](https://github.com/ChrisRus)
126126

0 commit comments

Comments
 (0)