Struct smol_graph::Graph[][src]

pub struct Graph<Node, EdgeData> {
    pub nodes: HashMap<NodeIndex, Node>,
    pub edges: HashMap<EdgeIndex, Edge<EdgeData>>,
}
Expand description

A graph generic over node and edge data.

Nodes and edges are public because this graph makes no guarantees as to its structure beyond being a graph.

The graph does provide convenience functions for some simple operations over its data.

Fields

nodes: HashMap<NodeIndex, Node>edges: HashMap<EdgeIndex, Edge<EdgeData>>

Implementations

Create a new graph with empty nodes and edges.

To initialize with capacity or other pre-defined settings, create it using public fields.

An iterator over this graph’s nodes, in no particular order.

An iterator over this graph’s edges, in no particular order.

A convenience function to insert an edge at a new index.

Attempt to remove an edge from this graph, returning it if it existed.

A convenience function to insert a node at a new index.

Attempt to remove a node from this graph, returning it if it existed.

Note that this will not check if any edges still have the node referenced.

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.