Skip to main content

MultiDiGraph

Struct MultiDiGraph 

Source
pub struct MultiDiGraph { /* private fields */ }

Implementations§

Source§

impl MultiDiGraph

Source

pub fn clone_with_fresh_policy(&self) -> Self

br-r37-c1-7dpyg: structural clone with a FRESH RuntimePolicy — see Graph::clone_with_fresh_policy.

Source

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.

Source

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.

Source

pub fn new(mode: CompatibilityMode) -> Self

Source

pub fn with_runtime_policy(runtime_policy: RuntimePolicy) -> Self

Source

pub fn strict() -> Self

Source

pub fn hardened() -> Self

Source

pub fn mode(&self) -> CompatibilityMode

Source

pub fn node_count(&self) -> usize

Source

pub fn edge_count(&self) -> usize

Source

pub fn number_of_selfloops(&self) -> usize

Source

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.

Source

pub fn edge_keys_iter( &self, source: &str, target: &str, ) -> Option<impl Iterator<Item = &usize>>

Edge keys as iterator.

Source

pub fn revision(&self) -> u64

Source

pub fn has_node(&self, node: &str) -> bool

Source

pub fn has_edge(&self, source: &str, target: &str) -> bool

Source

pub fn nodes_ordered(&self) -> Vec<&str>

Source

pub fn successors(&self, node: &str) -> Option<Vec<&str>>

Source

pub fn predecessors(&self, node: &str) -> Option<Vec<&str>>

Source

pub fn neighbors(&self, node: &str) -> Option<Vec<&str>>

Source

pub fn node_attrs(&self, node: &str) -> Option<&AttrMap>

Source

pub fn edge_attrs( &self, source: &str, target: &str, key: usize, ) -> Option<&AttrMap>

Source

pub fn evidence_ledger(&self) -> &EvidenceLedger

Source

pub fn runtime_policy(&self) -> &RuntimePolicy

Source

pub fn set_runtime_policy(&mut self, runtime_policy: RuntimePolicy)

Source

pub fn is_directed(&self) -> bool

Source

pub fn is_multigraph(&self) -> bool

Source

pub fn out_degree(&self, node: &str) -> usize

Return the out-degree of a node (number of outgoing parallel edges).

Source

pub fn in_degree(&self, node: &str) -> usize

Return the in-degree of a node (number of incoming parallel edges).

Source

pub fn degree(&self, node: &str) -> usize

Return the degree of a node (in-degree + out-degree).

Source

pub fn add_node(&mut self, node: impl Into<String>) -> bool

Source

pub fn add_node_with_attrs( &mut self, node: impl Into<String>, attrs: AttrMap, ) -> bool

Source

pub fn add_edge( &mut self, source: impl Into<String>, target: impl Into<String>, ) -> Result<usize, GraphError>

Source

pub fn extend_nodes_with_attrs_unrecorded<I>(&mut self, nodes: I) -> usize
where I: IntoIterator<Item = (String, AttrMap)>,

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).

Source

pub fn extend_keyed_edges_with_attrs_unrecorded<I>(&mut self, edges: I) -> usize
where I: IntoIterator<Item = (String, String, usize, AttrMap)>,

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.

Source

pub fn extend_fresh_index_keyed_edges_with_attrs_unrecorded<I, N>( &mut self, nodes: N, edges: I, ) -> usize
where I: IntoIterator<Item = (usize, usize, usize, AttrMap)>, N: IntoIterator<Item = String>,

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.

Source

pub fn add_edge_with_attrs( &mut self, source: impl Into<String>, target: impl Into<String>, attrs: AttrMap, ) -> Result<usize, GraphError>

Source

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>

Source

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.

Source

pub fn replace_node_attrs(&mut self, node: &str, attrs: AttrMap) -> bool

br-r37-c1-sjf4t: overwrite the attribute map for an existing node.

Source

pub fn remove_edge( &mut self, source: &str, target: &str, key: Option<usize>, ) -> bool

Source

pub fn remove_node(&mut self, node: &str) -> bool

Source

pub fn edges_ordered(&self) -> Vec<MultiDiEdgeSnapshot>

Source

pub fn edges_ordered_borrowed(&self) -> Vec<(&str, &str, usize, &AttrMap)>

Source

pub fn try_for_each_edge_ordered_borrowed<E>( &self, visit: impl FnMut(&str, &str, usize, &AttrMap) -> Result<(), E>, ) -> Result<(), E>

Source

pub fn try_for_each_indexed_edge_ordered_borrowed<E>( &self, visit: impl FnMut(usize, usize, &str, &str, usize, &AttrMap) -> Result<(), E>, ) -> Result<(), E>

Source

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.

Source

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.

Source

pub fn snapshot(&self) -> MultiDiGraphSnapshot

Trait Implementations§

Source§

impl Clone for MultiDiGraph

Source§

fn clone(&self) -> MultiDiGraph

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for MultiDiGraph

Source§

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

Formats the value using the given formatter. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.