pub struct MultiDiGraph { /* private fields */ }Implementations§
Source§impl MultiDiGraph
impl MultiDiGraph
Sourcepub fn clone_with_fresh_policy(&self) -> Self
pub fn clone_with_fresh_policy(&self) -> Self
br-r37-c1-7dpyg: structural clone with a FRESH RuntimePolicy — see Graph::clone_with_fresh_policy.
Sourcepub fn reorder_pred_rows_for_nx_copy_walk(&mut self)
pub fn reorder_pred_rows_for_nx_copy_walk(&mut self)
br-r37-c1-s0d4x: reorder every PRED row into NetworkX’s
MultiDiGraph.copy() walk order — the multigraph counterpart of
DiGraph::reorder_pred_rows_for_nx_copy_walk: each pred row’s cells
sort by (pos(u), index of v within succ[u]); succ rows are
recreated in their original order by the u-major walk.
Sourcepub fn apply_row_orders(&mut self, orders: &[(String, Vec<String>)], pred: bool)
pub fn apply_row_orders(&mut self, orders: &[(String, Vec<String>)], pred: bool)
br-r37-c1-u3qyn: restore explicit succ/pred row orders (pickle
round-trip) — see Graph::apply_row_orders. Keyed cells move
wholesale; pred selects the adjacency side.
pub fn new(mode: CompatibilityMode) -> Self
pub fn with_runtime_policy(runtime_policy: RuntimePolicy) -> Self
pub fn strict() -> Self
pub fn hardened() -> Self
pub fn mode(&self) -> CompatibilityMode
pub fn node_count(&self) -> usize
pub fn edge_count(&self) -> usize
pub fn number_of_selfloops(&self) -> usize
Sourcepub fn edge_keys(&self, source: &str, target: &str) -> Option<Vec<usize>>
pub fn edge_keys(&self, source: &str, target: &str) -> Option<Vec<usize>>
Return an iterator over keys for edges from source to target. Edge keys as Vec.
Sourcepub fn edge_keys_iter(
&self,
source: &str,
target: &str,
) -> Option<impl Iterator<Item = &usize>>
pub fn edge_keys_iter( &self, source: &str, target: &str, ) -> Option<impl Iterator<Item = &usize>>
Edge keys as iterator.
pub fn revision(&self) -> u64
pub fn has_node(&self, node: &str) -> bool
pub fn has_edge(&self, source: &str, target: &str) -> bool
pub fn nodes_ordered(&self) -> Vec<&str>
pub fn successors(&self, node: &str) -> Option<Vec<&str>>
pub fn predecessors(&self, node: &str) -> Option<Vec<&str>>
pub fn neighbors(&self, node: &str) -> Option<Vec<&str>>
pub fn node_attrs(&self, node: &str) -> Option<&AttrMap>
pub fn edge_attrs( &self, source: &str, target: &str, key: usize, ) -> Option<&AttrMap>
pub fn evidence_ledger(&self) -> &EvidenceLedger
pub fn runtime_policy(&self) -> &RuntimePolicy
pub fn set_runtime_policy(&mut self, runtime_policy: RuntimePolicy)
pub fn is_directed(&self) -> bool
pub fn is_multigraph(&self) -> bool
Sourcepub fn out_degree(&self, node: &str) -> usize
pub fn out_degree(&self, node: &str) -> usize
Return the out-degree of a node (number of outgoing parallel edges).
Sourcepub fn in_degree(&self, node: &str) -> usize
pub fn in_degree(&self, node: &str) -> usize
Return the in-degree of a node (number of incoming parallel edges).
Sourcepub fn degree(&self, node: &str) -> usize
pub fn degree(&self, node: &str) -> usize
Return the degree of a node (in-degree + out-degree).
pub fn add_node(&mut self, node: impl Into<String>) -> bool
pub fn add_node_with_attrs( &mut self, node: impl Into<String>, attrs: AttrMap, ) -> bool
pub fn add_edge( &mut self, source: impl Into<String>, target: impl Into<String>, ) -> Result<usize, GraphError>
Sourcepub fn extend_nodes_with_attrs_unrecorded<I>(&mut self, nodes: I) -> usize
pub fn extend_nodes_with_attrs_unrecorded<I>(&mut self, nodes: I) -> usize
br-r37-c1-l5ve7: bulk node insert WITH attrs, one ledger record — MultiDiGraph mirror of DiGraph::extend_nodes_with_attrs_unrecorded. Existing nodes merge attrs (extend).
Sourcepub fn extend_keyed_edges_with_attrs_unrecorded<I>(&mut self, edges: I) -> usize
pub fn extend_keyed_edges_with_attrs_unrecorded<I>(&mut self, edges: I) -> usize
br-r37-c1-l5ve7: bulk KEYED edge insert WITH attrs, one ledger record — for native copy/convert paths that replicate a source multigraph’s exact internal keys (add_edge_impl pays TWO record_decision calls per edge). Endpoint nodes are created on demand; an existing (u, v, key) cell merges attrs (extend), matching add_edge_with_key_and_attrs.
Sourcepub fn extend_fresh_index_keyed_edges_with_attrs_unrecorded<I, N>(
&mut self,
nodes: N,
edges: I,
) -> usize
pub fn extend_fresh_index_keyed_edges_with_attrs_unrecorded<I, N>( &mut self, nodes: N, edges: I, ) -> usize
Bulk-add keyed attributed directed multiedges into a fresh graph when the
caller has already assigned NetworkX-compatible node indices and per-pair
keys. This avoids hashing/copying canonical endpoint strings for every
edge in fresh MultiDiGraph.add_edges_from batches.
pub fn add_edge_with_attrs( &mut self, source: impl Into<String>, target: impl Into<String>, attrs: AttrMap, ) -> Result<usize, GraphError>
pub fn add_edge_with_key_and_attrs( &mut self, source: impl Into<String>, target: impl Into<String>, key: usize, attrs: AttrMap, ) -> Result<usize, GraphError>
Sourcepub fn replace_edge_attrs(
&mut self,
source: &str,
target: &str,
key: usize,
attrs: AttrMap,
) -> bool
pub fn replace_edge_attrs( &mut self, source: &str, target: &str, key: usize, attrs: AttrMap, ) -> bool
br-r37-c1-sjf4t: overwrite the attribute map for an existing (source, target, key) edge. Returns whether the edge existed.
Sourcepub fn replace_node_attrs(&mut self, node: &str, attrs: AttrMap) -> bool
pub fn replace_node_attrs(&mut self, node: &str, attrs: AttrMap) -> bool
br-r37-c1-sjf4t: overwrite the attribute map for an existing node.
pub fn remove_edge( &mut self, source: &str, target: &str, key: Option<usize>, ) -> bool
pub fn remove_node(&mut self, node: &str) -> bool
pub fn edges_ordered(&self) -> Vec<MultiDiEdgeSnapshot>
pub fn edges_ordered_borrowed(&self) -> Vec<(&str, &str, usize, &AttrMap)>
pub fn try_for_each_edge_ordered_borrowed<E>( &self, visit: impl FnMut(&str, &str, usize, &AttrMap) -> Result<(), E>, ) -> Result<(), E>
pub fn try_for_each_indexed_edge_ordered_borrowed<E>( &self, visit: impl FnMut(usize, usize, &str, &str, usize, &AttrMap) -> Result<(), E>, ) -> Result<(), E>
Sourcepub fn reversed(&self) -> Self
pub fn reversed(&self) -> Self
Return a reversed copy with NetworkX-compatible node/edge row order.
This is the directed-multigraph sibling of DiGraph::reversed, but it
cannot simply swap successors and predecessors: NetworkX materializes
MultiDiGraph.reverse(copy=True) by walking G.edges(keys=True, data=True)
in source-node order and adding (v, u, key) to the result. Predecessor
rows may have been formed by historical edge insertion order, which is not
always the same as that source-major edge stream. Rebuild the two row maps
from the observed edge stream while avoiding the expensive per-edge
add_edge policy path.
Sourcepub fn out_edges_ordered_borrowed<'a>(
&'a self,
node: &str,
) -> Vec<(&'a str, &'a str, usize, &'a AttrMap)>
pub fn out_edges_ordered_borrowed<'a>( &'a self, node: &str, ) -> Vec<(&'a str, &'a str, usize, &'a AttrMap)>
Out-edges of a single source node in nx adjacency order (successors[node].keys() then key-bucket order), borrowing attrs.
Equivalent to edges_ordered_borrowed() filtered to one source,
but O(out-deg(node)) instead of O(E) — and it clones nothing. Used
by MultiDiGraph.edges(nbunch) to avoid scanning/cloning every
edge when only a handful of sources are requested.
pub fn snapshot(&self) -> MultiDiGraphSnapshot
Trait Implementations§
Source§impl Clone for MultiDiGraph
impl Clone for MultiDiGraph
Source§fn clone(&self) -> MultiDiGraph
fn clone(&self) -> MultiDiGraph
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more