Skip to main content

parse_edge_list_ordered

Function parse_edge_list_ordered 

Source
pub fn parse_edge_list_ordered(input: &str) -> (usize, Vec<Vec<usize>>)
Expand description

Parse an undirected edge list from text.

Lines starting with # or blank are skipped (nx.read_edgelist convention). Parallel edges are deduplicated (nx.Graph semantics). Self-loops are kept: networkx stores v in its own adjacency G[v], so adj[v] includes v. This matters because local_efficiency induces a subgraph on G[v], and a self-loop makes v a member of that neighbour set. Node IDs are assigned in first-seen order (matching networkx insertion order).

Returns (n, adj) where adj[i] is the neighbour list of node i in insertion order, including i itself when i carries a self-loop.