All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog. and this project adheres to Semantic Versioning.
- All methods that used to return a map or nodes or edges now return arrays.
- There are corresponding methods that still return maps where the method name is suffixed with 'map', as in nodeMap or succesorMap()
- Added source and target getters for Edge
- Added return types to toposort() and findCycles()
- All methods that used to return N now return Node
- All methods that used to return E now return Edge
- All filter predicates that used to get E as param now get Edge
- Returning types as
this
instead ofGraph<N, E>
to improve support for inheritence. - Added graphNodes and graphEdges getters that return full nodes/edges objects.
- Added successorsLayers and predecessorsLayers.
- successors and predecessors subgraph methods refactored and support multiple entry points.
- added overrideExisting flag (default true) to setNode(), setNodes(), setEdge(), setEdges()
- g.parse() can now accept json param as string or object.
- Added g.toJson() that returns the graph as a JSON object. User can define on N and E a specific toJson() method. If not defined, the N and E objects will be used as they are.
- Added optional parameters to g.parse(): parseNode() and parseEdge() which allows users to define their own parse functions to the generic Node and Edge
- Added edgeNodesById(edgeId:string) that allows sending an edgeId of the format "a->b" and returns { sourceId: string | undefined, targetId: string | undefined}
- Added allPaths(source, target) which finds all possible paths between two nodes
- Changed the output of graph stringify() to match the input of graph parse():
{
nodes: {id: string, node: string}[],
edges: {sourceId: string, targetId: string, edge: string}[]
}
- fixed graph stringify()
- Added graph parse(json:string) which builds a graph from JSON string
- N and E should now implement 'strigify()' instead of 'toString()' for graph serialization. Otherwise a default stringify() will be called, which may not work with complex objects.
- fixed findCycles()
- return type change in toposort and small fix in readme
- Added merge() method.
- Removed nodesMap() and edgesMap(). nodes and edges getters now return a map.
- Corrected graph.stringify()
- Separated node and edge IDs from their data:
- setters signatures changed:
- setNode(id: string, node: N)
- setEdge(sourceId: string, targetId: string, edge: E)
- setNodes(nodes: {id: string, node: N}[])
- setEdges(edges: {sourceId: string, targetId: string, edge:E}[])
- API getters now get nodeId(string), and return N (user defined node) objects and not the internal GraphNode objects.
- Updated all related code and added internal getters and setters that return GraphNode objects.
- setters signatures changed:
- No longer need to implement Serializable. Implementing toString() is now optional on the user-defined node (N). If not implemented, the default JSON.stringify() is used.
- Added graph sinks and sources.
- Made sure toposort can't return undefined.
- Added fromString() and fromObject() static functions on Node and Edge.
- In toposort() removed initial nodes filter and added reverse (default false) for ordering of results.
- In toposort() now returning an array of nodes and not an array of keys.
- Changed fromString() to optional on Serializable.
- findCycles()
- isCyclic()
- tarjan algorithm
- stringify() on whole graph or sub-graph
- generics N and E now extend Serializable. Must implement toString() and fromString()
- Removed GraphLib and rewrote Graph from scratch without dependency on external graph library. New set of APIs and models.
- Basic graph setters and getters
- Added successors and predecessors
- Added recursive successors and predecessors returned as array and sub-graph