static createSegment(parent, id, treeMarkers, parentIsLastChild) {
    const node = parent[id];
    const siblings = Object.keys(parent);
    const isLastChild = siblings.indexOf(id) === (siblings.length - 1);
    const hasChildren = !!node.children && Object.keys(node.children).length > 0;

    // Copy the tree markers so that we don't change by reference.
    const newTreeMarkers = Array.isArray(treeMarkers) ? treeMarkers.slice(0) : [];

    // Add on the new entry.
    if (typeof parentIsLastChild !== 'undefined') {
      newTreeMarkers.push(!parentIsLastChild);
    }

    return {
      node,
      isLastChild,
      hasChildren,
      treeMarkers: newTreeMarkers,
    };
  }
Helper to create context for each critical-request-chain node based on its
parent. Calculates if this node is the last child, whether it has any
children itself and what the tree looks like all the way back up to the root,
so the tree markers can be drawn correctly.
@param {LH.Audit.Details.SimpleCriticalRequestNode|LH.Audit.Details.NetworkNode} parent
@param {string} id
@param {Array<boolean>=} treeMarkers
@param {boolean=} parentIsLastChild
@return {NetworkSegment}