Skip to content

Main content

Directed Graph Density Loop Policy Tool

Compute directed graph density loop policy from explicit bounded inputs.

Loading tool…

Description

Use n² possible edges when allowLoops or n(n-1) otherwise, require a positive denominator and edges within it, then divide.

A graph's degree records how many edge incidences meet a vertex. Directed edges distinguish incoming and outgoing incidences, while loops and parallel edges require explicit counting conventions; a local degree formula does not reconstruct a graph.

Use n² possible edges when allowLoops or n(n-1) otherwise, require a positive denominator and edges within it, then divide.

When to use this tool

Use Directed Graph Density Loop Policy when you need a degree or incidence calculation under the stated graph convention.

How to use the tool and how it works

  1. Enter vertices, edges, allowLoops. Use the units and conventions below.
  2. Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
  3. Read possibleEdges, density. Use the output convention below.

Require vertices 1-1000000 and nonnegative integer edges. Use n² possible edges when allowLoops or n(n-1) otherwise, require a positive denominator and edges within it, then divide.1

Input fieldMeaning and unitsAccepted input
verticesVerticesRequired. Safe integer; minimum 1; maximum 1000000.
edgesEdgesRequired. Safe integer; minimum 0.
allowLoopsAllow LoopsRequired. Boolean.
Output fieldInterpretationReturned shape
possibleEdgesPossible EdgesRequired. Finite number.
densityDensityRequired. Finite number.
json
{
  "input": {
    "vertices": 3,
    "edges": 3,
    "allowLoops": false
  },
  "output": {
    "possibleEdges": 6,
    "density": 0.5
  }
}

Limitations and assumptions

  • A singleton without loops is rejected because density is undefined under this contract; supplied counts assume at most one edge per ordered pair and no adjacency is checked.
  • Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.
  • Numeric calculations use binary floating point unless exact decimal-integer arithmetic is explicitly stated. No hidden measurement tolerance or decimal rounding is added; nonfinite or out-of-contract results are rejected. Numeric signed-zero results are exported as zero.

Alternative or Complementary methods

Build an adjacency structure and count actual incidences when a full graph is available. Validate loop, multiplicity, direction, and vertex-set assumptions before applying a simple-graph identity.

References

  1. Calculation and input contract: graph/directed-graph-density-loop-policy — tool.io

Similar or alternative tools