- Graph toString() is not longer included in error messages. In most cases its excessive verbosity made it difficult to debug errors in the Chrome debugger.
- No longer expose data.Set and data.PriorityQueue from graphlib. The former is
now available in the
cp-set
npm module. The later can be made available in a similar way if necessary.
- assert.deepEqual(g.copy(), g) now returns true.
- ~5x speedup for filterNodes.
- Doc fixes.
- Some performance improvement to delNode and filterNodes.
- Added preorder and postorder tree traversal functions.
- Fixed bug where graph value was not copied correctly with graph.copy().
- Fix toString, copy, filterNodes for compound graphs.
components
now works for directed graphs.
- Rely less on instanceof checks which may fail with different versions of the library loaded.
- Added a JSON encoder / decoder
- Fixed bug where removing a node would not remove it from its parent's children set.
- Fixed bug where addNode would use
{}
as the default value if a initial value was not assigned. - Fixed bug where auto-assiged id was not used correcty in compound graphs.
addNode
now behaves likeaddEdge
in that it assigns a unique id to the node if the given id wasundefined
ornull
.
The release introduces these backwards incompatible changes:
- Removed
equals
fromGraph
andDigraph
. This was used for test only. Useassert.deepEqual
instead.
This release also introduces compound graphs. See the API docs for CGraph
and
CDigraph
for details.
- No externally visible changes.
(di)graph.addEdge(...)
now returns the id of the edge added.- Fix bug where auto-assigned edge ids could collide with existing edge ids.
This release introduces backwards incompatible changes.
subgraph
has been removed. Instead of:
graph.subgraph([1, 2, 3]);
Use:
var filter = require("graphlib").filter;
graph.filterNodes(filter.nodesFromList([1, 2, 3]));
The following are backwards compatible changes:
- Introduced
graph.filterNodes
for creating a new graph by applying a filter to nodes ingraph
. - Add a new module
filter
that includes some simple filters.
- More doc improvements.
- Initial pass at nicer documentation.
- @solleks fixed a bug in which
alg.floydWarshall
could return the wrong shortest path with multiple edges between the same nodes (#10).
- Added Prim's Algorithm (
alg.prim
). - Added method to change a directed graph to an undirected graph
(
Digraph.asUndirected
). - Added method to change an undirected graph to a directed graph
(
Graph.asDirected
).
- Added algorithm for finding connected components in an undirected Graph
(
alg.components
). - Added Floyd-Warshall algorithm (
alg.floydWarshall
).
- Added an undirected multi-graph implementation (
Graph
). - Added a Set datatype (
data.Set
).
- Added Dijkstra's Algorithm (
alg.dijkstra
) for finding all single source shortest paths. - Added
alg.dijkstraAll
for finding all shortest paths.
This release introduces backwards incompatible changes.
Graph
was renamed toDigraph
in v0.0.4. This release removesGraph
. Please useDigraph
in its place.Digraph.edges
no longer takes any arguments. It always returns all edges in the graph.- The equivalent of
Digraph.edges(u)
is nowDigraph.incidentEdges(u)
. - The equivalent of
Digraph.edges(u, v)
is nowDigraph.outEdges(u, v)
orDigraph.inEdges(v, u)
.
- The equivalent of
The following are backwards compatible changes:
- Added a new optional parameter to
Digraph.outEdges
to filter the results by the source node. See API documentation for details. - Added a new optional parameter to
Digraph.inEdges
to filter the results by the target node. See API documentation for details. - Added a new method,
Digraph.incidentEdges
, that returns all edges incident on a nodeu
withDigraph.incidentEdges(u)
or all edges between two nodes - regardless of direction - withDigraph.incidentEdges(u, v)
.
- Add an min priority queue (data.PriorityQeuue).
- Add an implementation of Tarjan's algorithm (alg.tarjan).
- Add a function to find and return all cycles in a graph (alg.findCycles).
- Added a value to the graph itself, similar to the values for nodes and edges.
Use
Digraph.graph()
to get the value andDigraph.graph(x)
to set the graph's value tox
. - Added support for changing the value of node's and edge's by supply
additional value argument. For example, to set the value
x
on nodeu
, callDigraph.node(u, x)
.
- Renamed Graph to Digraph. Graph is now an alias to Digraph, but will be removed in a subsequent release.
- Added
sources
andsinks
to Graph. - Added topsort algorithm.
- Added isAcyclic algorithm.
- Initial release.