scglue.graph.collapse_multigraph
- scglue.graph.collapse_multigraph(graph, merge_fns=None)[source]
Collapse multi-edges into simple-edges
- Parameters
graph (
MultiGraph
) – Input multi-graphmerge_fns (
typing.Optional
[typing.Mapping
[str
,typing.Callable
]]) – Attribute-specific merge functions, indexed by attribute name. Each merge function should accept a list of values and return a single value.
- Return type
- Returns
collapsed – Collapsed graph
Note
The collapsed graph would be directed if the input graph is directed. Edges causing ValueError in
merge_fns
will be discarded.