Base Edge Algorithm

This necessitates formulate discrete operators on graphs which are analogous to differential operators in calculus, such as graph Laplacians (or discrete Laplace operators) as discrete versions of the Laplacian, and use these operators to formulate differential equations, difference equations, or variational models on graphs which can be interpreted as discrete versions of partial differential equations or continuum variational models. In applications, finite weighted graphs represent a finite number of entity by the graph's vertices, any pairwise relationships between these entity by graph edges, and the meaning of a relationship by an edge weight function.
package org.gs.graph

/** Common code for edge, directed edge
  *
  * @constructor called by subclass with both vertices and a weight
  * @param v edge of vertex
  * @param w edge of vertex
  * @param weight of edge
  * @see [[https://algs4.cs.princeton.edu/43mst/Edge.java.html]]
  * @see [[https://algs4.cs.princeton.edu/44sp/DirectedEdge.java.html]]
  * @author Scala translation by Gary Struthers from Java by Robert Sedgewick and Kevin Wayne.
  */
abstract class BaseEdge(v: Int, w: Int, val weight: Double) {
  require(v >= 0 && w >= 0 && !weight.isNaN, "s invalid arg(s) v:$v w:$w weight$weight")

  override def toString: String = f"$v%d-$w%d $weight%.5f "
}

LANGUAGE:

DARK MODE: