pub fn edge_mapping(
new_graph: &Graph,
old_graph: &Graph,
new_to_old: &NodeMapping,
) -> EdgeMappingExpand description
Returns the edge mapping from new_graph to old_graph that goes with the node mapping
new_to_old.
Edge s -> t of new_graph maps to the edge new_to_old.get(s) -> new_to_old.get(t) of
old_graph, or to None if old_graph has no such edge or s or t maps to None. For a graph
from remapped(old_graph, new_to_old), every edge has its counterpart, and the
gather functions of the result carry data on the edges over to the new graph. Here, site_count
holds the number of call sites of each call by edge index of calls, and the subgraph loading
from the example at remapped takes these counts along:
let loading_site_count =
graphs::edge_mapping(&loading, &calls, &new_to_old).gather(&site_count);
// 1 for load -> parse and for load -> read, 2 for parse -> parseFor the opposite direction, from the edges of old_graph to those of new_graph, invert the
result with EdgeMapping::inverted. The transposed graph needs transposed_edge_mapping
instead, as its edges run the other way.
Time: O(node_count + edge_count log max_out_degree), with the node and edge count of
new_graph and the out-degrees of old_graph.
Memory: 4 bytes per edge of new_graph for the result.
ยงPanics
With an invalid argument message if new_to_old.index_count() != new_graph.node_count(); with an
index out of bounds message if a node of new_graph maps to an ID that is not a node of
old_graph.