• Makes a connection between options.a and one or more nodes in options.b. Same as connectWithEdges but only the Graph is returned.

    let g = graph(); // Create an empty graph
    // Make a connection between `red` and `orange`
    g = connect(g, { a: `red`, b: `orange` });

    // Make a connection between `red` and `orange as well as `red` and `yellow`.
    g = connect(g, { a: `red`, b: [`orange`, `yellow`] })

    Parameters

    • graph: Readonly<{
          edges: readonly Readonly<{
              a: string;
              b: string;
              weight?: number;
          }>[];
          vertices: IMapImmutable<string, Readonly<{
              id: string;
          }>>;
      }>

      Initial graph

    • options: Readonly<{
          a: string;
          b: string | string[];
          weight?: number;
      }>

      Options

    Returns Graph