Skip to content

Main content

Tree Leaf Degree Deficit

Sum explicit vertex degree deficits 2-degree and count degree-one vertices without certifying that the graph is a tree.

Loading tool…

Description

Count degree-one vertices and sum the two-minus-degree contributions of a supplied degree list.

Graph records separate vertex/edge identities, direction, degree counts and weighted-entry conventions. A zero weight differs from no edge, and local degree balance or endpoint continuity does not establish a whole graph’s connectivity or a valid traversal. Parallel edges need an explicit occurrence convention.

Count degree-one vertices and sum the two-minus-degree contributions of a supplied degree list.

When to use this tool

Use Tree Leaf Degree Deficit when checking the stated graph degree, walk, key or entry-presence convention.

How to use the tool and how it works

  1. Enter degrees. 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 leafCount, totalTwoMinusDegree. Use the output convention below.

Require nonnegative whole supplied degrees. Count entries equal to one and sum 2-degree using exact integer intermediates, exporting the total as a number.1

Input fieldMeaning and unitsAccepted input
degreesDegreesRequired. Array of safe integer; maximum items 256.
Output fieldInterpretationReturned shape
leafCountLeaf CountRequired. Safe integer.
totalTwoMinusDegreeNumeric export of sum(2-degree) with exact integer intermediates; not an exact decimal-text result.Required. Safe integer.
json
{
  "input": {
    "degrees": [
      1,
      2,
      1
    ]
  },
  "output": {
    "leafCount": 2,
    "totalTwoMinusDegree": 2
  }
}

Limitations and assumptions

  • The degree list is not checked for realizability, connectivity or a tree; numerical export does not promise arbitrary-precision integer text.
  • 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.

Alternative or Complementary methods

Use the complete graph and appropriate structural/traversal algorithms for realizability, connectivity, Eulerian properties and globally unique edge handling.

References

  1. Calculation and input contract: graph/tree-leaf-degree-deficit — tool.io

Similar or alternative tools