Struct AdjacencyNodeList

Source
pub struct AdjacencyNodeList { /* private fields */ }
Expand description

Sparse, node first, adjacency list

Space Complexity

  • O ( | V | + | E | ) for undirected graph(deprecated)
  • O ( | V | + 2 | E | ) for directed graph

Node Time Complexity

This structure has very good performance for nodes

  • Insert: O ( 1 )
  • Query: O ( 1 )
  • Removal: O ( 1 )
  • Count: O ( 1 )
  • Neighbors: O ( 1 )

Edge Time Complexity

This structure has linear complexity across the edges

  • Insert edge: O ( 1 )
  • Query edge: O ( | V | )
  • Removal edge: O ( | V | )
  • Count edges: O ( | V | )

Trait Implementations§

Source§

impl Debug for AdjacencyNodeList

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for AdjacencyNodeList

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'a> GraphEngine<'a> for AdjacencyNodeList

Source§

type NeighborIterator = PlaceholderNodeIterator

According to a given vertex, find all neighbor nodes
Source§

type BridgeIterator = PlaceholderEdgeIterator

An iterator over the edges.
Source§

type NodeTraverser = PlaceholderNodeIterator

An iterator over the nodes.
Source§

type EdgeTraverser = PlaceholderNodeIterator

An iterator over the edges.
Source§

type BridgeTraverser = PlaceholderEdgeIterator

An iterator over the edges.
Source§

fn graph_kind(&self) -> GraphKind

Check the graph kind, it can be directed or undirected. Read more
Source§

fn get_node(&self, node: NodeID) -> Result<NodeID, GraphError>

Check if the node exists, return the node id if exists. Read more
Source§

fn all_nodes(&self) -> Self::NodeTraverser

Traverse all nodes in the graph. Read more
Source§

fn all_neighbors(&'a self, node: NodeID) -> Self::NeighborIterator

Check if the node exists, return the node id if exists. Read more
Source§

fn get_edge(&self, edge: EdgeID) -> Result<EdgeID, GraphError>

Check if the edge exists, return the node id if exists. Read more
Source§

fn all_edges(&self) -> Self::EdgeTraverser

Get the edges of the graph. Read more
Source§

fn get_bridge(&self, edge: EdgeID) -> Result<IndeterminateEdge, GraphError>

Source§

fn get_bridges(&'a self, from: NodeID, goto: NodeID) -> Self::BridgeIterator

Give all edges matching the start and end points Read more
Source§

fn all_bridges(&self) -> Self::BridgeIterator

Get the edges of the graph. Read more
Source§

fn count_nodes(&'a self) -> usize

Count the number of nodes in the graph. Read more
Source§

fn get_outgoing(&'a self, node: usize) -> Self::NeighborIterator

Find all vertices ending at a given point Read more
Source§

fn get_incoming(&'a self, node: usize) -> Self::NeighborIterator

Check if the node exists, return the node id if exists. Read more
Source§

fn count_degree(&'a self, node: usize) -> NodeDegree

Check if the node exists, return the node id if exists. Read more
Source§

fn count_edges(&'a self) -> usize

Count the number of edges in the graph. Read more
Source§

fn size_hint(&self) -> usize

Query the total space occupied by the structure, return 0 if failed to query Read more
Source§

impl MutableGraph for AdjacencyNodeList

Source§

fn insert_node(&mut self, node_id: usize) -> bool

Insert a node without any neighbors (edges). Read more
Source§

fn create_node(&mut self) -> usize

Insert a node without any neighbors (edges). Read more
Source§

fn remove_node_with_edges(&mut self, node_id: usize)

Remove the given node and all edges connected to it. Read more
Source§

fn insert_edge_with_nodes<E: Edge>(&mut self, edge: E) -> EdgeInsertID

Insert edge to graph, if the nodes does not exist, also insert them. Read more
Source§

fn remove_edge<E>(&mut self, edge: E)
where E: Into<EdgeQuery>,

Remove edge by given edge-id or start and end node-id. Read more
Source§

fn remove_node(&mut self, node_id: usize)

Remove the given node. Read more
Source§

fn insert_edge<E>(&mut self, edge: E) -> EdgeInsertID
where E: Edge,

Insert a edge between two nodes. Read more
Source§

fn shrink(&mut self)

Remove invalid edges and nodes to improve the efficiency of subsequent queries.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.