Module fast_graph::edge

source ·
Expand description

§A struct representing an edge in the graph.

Contains an EdgeID which is a key to the edge in the slotmap, and two NodeIDs which are the nodes the edge connects (from & to).

An edge can also have “data”, which could be anything or nothing; for example the weight of the connection or a struct or enum representing something else.

§Why is there no “EdgeTrait”?

The Edge struct is very simple and doesn’t need a trait. It’s just a struct with an ID, two node IDs, and some data. If you want to add more functionality or data to the edge you can probably just add it to the data field, or add an edge as a field to your custom type.

Structs§

  • A struct representing an edge in the graph.
  • An index to an edge in the slotmap