LinkedGraph in rustc_data_structures::graph::linked_graph - Rust (original) (raw)
Struct LinkedGraph
pub struct LinkedGraph<N, E> {
nodes: Vec<Node<N>>,
edges: Vec<Edge<E>>,
}Expand description
A concrete graph implementation that supports:
- Nodes and/or edges labelled with custom data types (
NandErespectively). - Incremental addition of new nodes/edges (but not removal).
- Flat storage of node/edge data in a pair of vectors.
- Iteration over any node’s out-edges or in-edges, via linked lists threaded through the node/edge data.
§Caution
This is an older graph implementation that is still used by some pieces of diagnostic/debugging code. New code that needs a graph data structure should consider using VecGraph instead, or implementing its own special-purpose graph with the specific features needed.
This graph implementation predates the later graph traits, and does not implement those traits, so it has its own implementations of a few basic graph algorithms.
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 48 bytes