precedence-diagram-method
TypeScript icon, indicating that this package has built-in type declarations

1.0.12 • Public • Published

precedence-diagram-method

A library to calculate the critical path in an given precedence-diagram (Metra-Potential-Methode)

npm package MIT last commit downloads week downloads total

Npm publish size Quality Gate Bugs Coverage Code Smells Duplicated Lines (%) Maintainability Rating Reliability Rating Security Rating Technical Debt Vulnerabilities

Demo

Live Demo: https://fireboltcasters.github.io/PrecedenceDiagramMethod/

Coverage

Installtion

npm install precedence-diagram-method

Usage

import {PrecedenceGraph} from "precedence-diagram-method";


let exampleGraph = {
    "StartLabel": {
        "children": [
            "Marketing",
            "Documentation"
        ],
        "duration": 0
    },
    "Marketing": {
        "children": [
            "Publishing"
        ],
        "duration": 3
    },
    "Documentation": {
        "children": [
            "Publishing"
        ],
        "duration": 4
    },
    "Publishing": {
        "children": [],
        "duration": 2
    }
}

let instance = new PrecedenceGraph(exampleGraph, "StartLabel");
let calcedGraph = instance.getGraph();
let criticalPath = instance.getCriticalPaths();

Each node will have to be in the following format:

<NameOfTheActiticy>: {
    "children": [<Array of children names>],
    "duraion": <DurationOfTheActivity>
}

Each node will have the following fields

Node fields

  • duration: number
  • buffer: number
  • earliestStart: number
  • earliestEnd: number
  • latestStart: number
  • latestEnd: number
  • children: [Node]
  • parents: [Node]

Documentation

You can also use additional methods:

instance ()


Get the current precedence graph

instance.getGraph()

Get the start node label of the precedence graph

instance.getStartNode()

Returns is a connection between a child and a parent is critical (no buffer)

instance.isCriticalPath(parentId, childId)

Get the start node label of the precedence graph

instance.getStartNode()

Gets all ciritcal paths

instance. isCriticalPath()

static

Returns true if the loop has a directed loop

PrecedenceGraph.hasLoop(graph)

Resets all calced times on a graph and returns a copy

PrecedenceGraph.resetCalcedTimesGraph(graph)

Calculates the forward precedence graph from a given startLabel and returns a copy

PrecedenceGraph.calcForwardGraph(graph, startLabel)

Returns the highest earliest end on a given graph

PrecedenceGraph.getFromAllEarliestEndsTheLatest(graph)

Sets the highest earliest end to the latest end of all leaf nodes

PrecedenceGraph.setLatestStartToAllLeafes(graph)

Calculates the backward precedence graph

PrecedenceGraph.calcBackwardGraph(graph)

Returns all leaves of a given graph

PrecedenceGraph.getAllLeafes(graph)

There a more functions which I wont describe here further. More information has to be read from the source code.

Contributors

The FireboltCasters

Contributors

Package Sidebar

Install

npm i precedence-diagram-method

Weekly Downloads

2

Version

1.0.12

License

MIT

Unpacked Size

29.6 kB

Total Files

12

Last publish

Collaborators

  • fireboltcaster