pub struct IndexedSubgraph {
pub nodes: HashMap<Nulid, Node>,
pub edges: HashMap<Nulid, Edge>,
pub outgoing: HashMap<Nulid, Vec<usize>>,
pub edge_list: Vec<Edge>,
}Expand description
Indexed form of a Subgraph for efficient traversal.
Built once via IndexedSubgraph::from_subgraph and then passed
to the detection functions.
Fields§
§nodes: HashMap<Nulid, Node>All nodes keyed by their NULID.
edges: HashMap<Nulid, Edge>All edges keyed by their NULID.
outgoing: HashMap<Nulid, Vec<usize>>Outgoing adjacency list: source node ID -> list of edge indices
(referencing Self::edge_list).
edge_list: Vec<Edge>Flat edge list for index-based access.
Implementations§
Source§impl IndexedSubgraph
impl IndexedSubgraph
Sourcepub fn from_subgraph(sg: &Subgraph) -> Self
pub fn from_subgraph(sg: &Subgraph) -> Self
Build an indexed subgraph from the raw deserialized input.
Sourcepub fn outgoing_edges(&self, node_id: Nulid) -> &[usize]
pub fn outgoing_edges(&self, node_id: Nulid) -> &[usize]
Return outgoing edges for a given node ID.
Sourcepub fn node_label(&self, node_id: Nulid) -> Option<&str>
pub fn node_label(&self, node_id: Nulid) -> Option<&str>
Return the label of a node, or None if not in the subgraph.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for IndexedSubgraph
impl RefUnwindSafe for IndexedSubgraph
impl Send for IndexedSubgraph
impl Sync for IndexedSubgraph
impl Unpin for IndexedSubgraph
impl UnsafeUnpin for IndexedSubgraph
impl UnwindSafe for IndexedSubgraph
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more