Skip to content
Alexandre Rabérin edited this page Oct 28, 2020 · 3 revisions

Edges (directed edge)

While a vertex could be any type with QuikGraph, the edge type must implement IEdge<TVertex> (and comply to it's contract). QuikGraph comes with various default implementations:

  • Classes
    • Edge<TVertex>, a vanilla implementation,
    • EquatableEdge<TVertex>, implements IEquatable<EquatableEdge<TVertex>>,
    • TaggedEdge<TVertex, TTag>, holds a tag,
    • TaggedEquatableEdge<TVertex, TTag>, equitable and holds a tag,
  • Structures
    • SEdge<TVertex>, an immutable edge,
    • SEquatableEdge<TVertex>, implements IEquatable<SEquatableEdge<TVertex>>,
    • STaggedEdge<TVertex, TTag>, holds a tag,
    • STaggedEquatableEdge<TVertex, TTag>, equitable and holds a tag,
    • SReversedEdge<TVertex, TEdge>, an struct reversing an edge,

The struct based edge will provide better performance and should be used when you do not plan to use custom edges. Of course, you can always implement your own version IEdge<TVertex>. Tagged edges also implement ITagged<TTag>.

Undirected edges

In undirected graphs, the order of the source or target vertices should not matter. In order to improve efficiency, edges that implement the IUndirectedEdge<TVertex> interface must sort the vertices so that Source <= Target (with respect to the default Comparer). This provides some performance gains in various data structures and algorithms.

  • Classes
    • UndirectedEdge<TVertex>, an vanilla implementation,
    • TaggedUndirectedEdge<TVertex, TTag>, holds a tag,
  • Structures
    • SUndirectedEdge<TVertex>, an immutable edge,
    • SUndirectedTaggedEdge<TVertex, TTag>, holds a tag
Clone this wiki locally