fn construct_hierarchy_edges(mut graph: Graph) -> Graph {
        // Construct the set of causal edges from the event set
        let len = graph.nodes.len();
        for i in 0..len {
            // if this node has a parent id, then find its parent event and use that
            if let Some(parent_id) = graph.nodes[i].parent_id {
                for j in 0..len {
                    if graph.nodes[j].id == parent_id {
                        graph.add_parent_edge(j, i);
                        break;
                    }
                }
            } else {
                // otherwise, search via the span system
                // Find the first event that precedes event i that also contains
                // event i
                for j in i + 1..len {
                    // if the span of trace[i] is a subset of the span of trace[j]
                    if contains(&graph.nodes[j], &graph.nodes[i]) {
                        // then trace[j] is the parent of trace[i]
                        // therefore add i to the adjacency list of j
                        graph.add_parent_edge(j, i);

                        // the first trace which contains i is the parent
                        // and the search must stop otherwise ancestors will be linked
                        break;
                    }
                }
            }
        }
        graph
    }
/// Given the underlying trace event data, construct the set of edges which
/// correspond to the parent->child hierarchy, where the parent event has the
/// smallest span which contains the child event.
Given the underlying trace event data, construct the set of edges which
correspond to the parent->child hierarchy, where the parent event has the
smallest span which contains the child event.
Given the underlying trace event data construct the set of edges which correspond to the parent - > child hierarchy where the parent event has the smallest span which contains the child event .
fn construct_hierarchy_edges(mut graph: Graph) -> Graph {
        // Construct the set of causal edges from the event set
        let len = graph.nodes.len();
        for i in 0..len {
            // if this node has a parent id, then find its parent event and use that
            if let Some(parent_id) = graph.nodes[i].parent_id {
                for j in 0..len {
                    if graph.nodes[j].id == parent_id {
                        graph.add_parent_edge(j, i);
                        break;
                    }
                }
            } else {
                // otherwise, search via the span system
                // Find the first event that precedes event i that also contains
                // event i
                for j in i + 1..len {
                    // if the span of trace[i] is a subset of the span of trace[j]
                    if contains(&graph.nodes[j], &graph.nodes[i]) {
                        // then trace[j] is the parent of trace[i]
                        // therefore add i to the adjacency list of j
                        graph.add_parent_edge(j, i);
                        // the first trace which contains i is the parent
                        // and the search must stop otherwise ancestors will be linked
                        break;
                    }
                }
            }
        }
        graph
    }
fn construct_hierarchy_edges ( mut graph : Graph ) -> Graph { // Construct the set of causal edges from the event set let len = graph . nodes . len ( ) ; for i in 0 .. len { // if this node has a parent id, then find its parent event and use that if let Some ( parent_id ) = graph . nodes [ i ] . parent_id { for j in 0 .. len { if graph . nodes [ j ] . id == parent_id { graph . add_parent_edge ( j , i ) ; break ; } } } else { // otherwise, search via the span system // Find the first event that precedes event i that also contains // event i for j in i + 1 .. len { // if the span of trace[i] is a subset of the span of trace[j] if contains ( & graph . nodes [ j ] , & graph . nodes [ i ] ) { // then trace[j] is the parent of trace[i] // therefore add i to the adjacency list of j graph . add_parent_edge ( j , i ) ; // the first trace which contains i is the parent // and the search must stop otherwise ancestors will be linked break ; } } } } graph }
Given the underlying trace event data, construct the set of edges which
correspond to the parent->child hierarchy, where the parent event has the
smallest span which contains the child event.
Given the underlying trace event data construct the set of edges which correspond to the parent - > child hierarchy where the parent event has the smallest span which contains the child event .
graph
Graph
graph
Graph