← All procedures

algebra.portSearchShares

This function gives the law of the search: the share of each count of connects to one destination before `EADDRNOTAVAIL`, over `rounds` rounds. An even range, and a range of one port, give their size in each round: the two passes reach each port. An odd range gives its size or one less, from the exact chain, up to `PORT_SEARCH_CHAIN_LARGEST` ports.

CLI
Package
@procedures/algebra · README
Path
["algebra","portSearchShares"]
CLI
mark algebra portSearchShares --size <number>
As data
{"$proc":["algebra","portSearchShares"],"input":{}}

Use it

In TypeScript

import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/algebra/register"; // registers its procedures

const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["algebra","portSearchShares"], { size: 1 });
console.log(JSON.stringify(result));

From the command line

$ mark algebra portSearchShares --size <number>

As data, in a program

{ "$proc": ["algebra", "portSearchShares"], "input": { "size": 1 } }

Input

FieldTypeRequiredDefaultDescription
sizenumberyes
roundsnumberno

Output

The schema does not list fields (any[][]).

JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "size": {
        "type": "number"
      },
      "rounds": {
        "type": "number"
      }
    },
    "required": [
      "size"
    ],
    "additionalProperties": false
  },
  "output": {
    "type": "array",
    "items": {
      "type": "array",
      "items": [
        {
          "type": "number"
        },
        {
          "type": "number"
        }
      ],
      "additionalItems": {},
      "minItems": 2,
      "maxItems": 2
    },
    "x-procedures-codec": "map"
  }
}