aonyx/graph/edge

Types

Represents an edge going from one node to another.

pub type Edge(key, label) {
  Edge(
    from: key,
    to: key,
    label: option.Option(label),
    weight: option.Option(Float),
  )
}

Constructors

  • Edge(
      from: key,
      to: key,
      label: option.Option(label),
      weight: option.Option(Float),
    )
pub type EdgeKey(key) {
  EdgeKey(from: key, to: key)
}

Constructors

  • EdgeKey(from: key, to: key)

Values

pub fn get_key(edge: Edge(a, b)) -> EdgeKey(a)

Extracts the key from an edge.

pub fn new(from: a, to: a) -> Edge(a, b)

Creates an edge with the given from and to node keys, without label or weight.

pub fn with_label(edge: Edge(a, b), label: b) -> Edge(a, b)

Sets the label of an edge.

pub fn with_weight(edge: Edge(a, b), weight: Float) -> Edge(a, b)

Sets the weight of an edge.

pub fn without_label(edge: Edge(a, b)) -> Edge(a, b)

Clears the label of an edge.

pub fn without_weight(edge: Edge(a, b)) -> Edge(a, b)

Clears the weight of an edge.

Search Document