Skip to content

parseEdgeList

parseEdgeList(text): ParsedEdges

Defined in: network/parse.ts:32

Parse a whitespace-separated edge list: source target [weight] per line. Blank lines and # comment lines are ignored.

Lines are split on "\n" and columns on the characters /\s/ matches; a line with a single column is skipped. Labels are exact strings ("1" and "01" are two nodes), indexed in first-seen order, source before target; duplicate edges and self-loops are kept. The weight is Number(column 3), so it can be NaN. Columns past the third are ignored.

O(characters) — a newline count to size the columns, then one scan — with no per-line or per-column strings: a label string is sliced once, when its node is first seen. Integer ids (the common SNAP / Infomap case) are indexed by value in a typed array rather than hashed as strings.

string

ParsedEdges