[−][src]Trait lib_dachshund::dachshund::graph_builder::GraphBuilder
Trait encapsulting the logic required to build a graph from a set of edge rows. Currently used to build typed graphs.
Required methods
fn _new(
nodes: HashMap<NodeId, Node>,
core_ids: Vec<NodeId>,
non_core_ids: Vec<NodeId>
) -> CLQResult<TGraph>
nodes: HashMap<NodeId, Node>,
core_ids: Vec<NodeId>,
non_core_ids: Vec<NodeId>
) -> CLQResult<TGraph>
Provided methods
fn init_nodes(
core_ids: &[NodeId],
non_core_ids: &[NodeId],
non_core_type_ids: &HashMap<NodeId, NodeTypeId>
) -> HashMap<NodeId, Node>
core_ids: &[NodeId],
non_core_ids: &[NodeId],
non_core_type_ids: &HashMap<NodeId, NodeTypeId>
) -> HashMap<NodeId, Node>
fn populate_edges(
rows: &[EdgeRow],
node_map: &mut HashMap<NodeId, Node>
) -> CLQResult<()>
rows: &[EdgeRow],
node_map: &mut HashMap<NodeId, Node>
) -> CLQResult<()>
given a set of initialized Nodes, populates the respective neighbors fields appropriately.
fn trim_edges(
node_map: &mut HashMap<NodeId, Node>,
min_degree: &usize
) -> HashSet<NodeId>
node_map: &mut HashMap<NodeId, Node>,
min_degree: &usize
) -> HashSet<NodeId>
Trims edges greedily, until all edges in the graph have degree at least min_degree.
Note that this function does not delete any nodes -- just finds nodes to delete. It is
called by prune
, which actually does the deletion.
fn new(
graph_id: GraphId,
rows: &[EdgeRow],
min_degree: Option<usize>
) -> CLQResult<TGraph>
graph_id: GraphId,
rows: &[EdgeRow],
min_degree: Option<usize>
) -> CLQResult<TGraph>
creates a TGraph object from a vector of rows. Client must provide graph_id which must match with each row's graph_id. If min_degree is provided, the graph is additionally pruned.
fn prune(
graph: TGraph,
rows: &[EdgeRow],
min_degree: usize
) -> CLQResult<TGraph>
graph: TGraph,
rows: &[EdgeRow],
min_degree: usize
) -> CLQResult<TGraph>
Takes an already-built graph and the edge rows used to create it, returning a new graph, where all nodes are assured to have degree at least min_degree. The provision of a TGraph is necessary, since the notion of "degree" does not make sense outside of a graph.
fn get_filtered_sources_targets_rows(
graph: TGraph,
min_degree: usize,
rows: &[EdgeRow]
) -> (Vec<NodeId>, Vec<NodeId>, Vec<EdgeRow>)
graph: TGraph,
min_degree: usize,
rows: &[EdgeRow]
) -> (Vec<NodeId>, Vec<NodeId>, Vec<EdgeRow>)
called by prune
, finds source and target nodes to exclude, as well as edges to exclude
when rebuilding the graph from a filtered vector of EdgeRows
.
Implementors
impl GraphBuilder<SimpleUndirectedGraph> for SimpleUndirectedGraphBuilder
[src]
fn _new(
nodes: HashMap<NodeId, Node>,
core_ids: Vec<NodeId>,
non_core_ids: Vec<NodeId>
) -> CLQResult<SimpleUndirectedGraph>
[src]
nodes: HashMap<NodeId, Node>,
core_ids: Vec<NodeId>,
non_core_ids: Vec<NodeId>
) -> CLQResult<SimpleUndirectedGraph>