@eagleoutice/flowr - v2.15.8
    Preparing search index...

    Variable DataflowConst

    Dataflow: {
        create: {
            empty: (
                this: void,
                cleanEnv?: REnvironmentInformation,
                idMap?: AstIdMap,
            ) => DataflowGraphBuilder<DataflowGraphVertexInfo>;
        };
        diff: {
            edges<Edge, Graph>(
                this: void,
                ctx: GraphDiffContext<Graph>,
                id: NodeId,
                lEdges: ReadonlyMap<NodeId, Edge> | undefined,
                rEdges: ReadonlyMap<NodeId, Edge> | undefined,
                diffEdge: (
                    edge: Edge,
                    otherEdge: Edge,
                    ctx: GraphDiffContext<Graph>,
                    id: NodeId,
                    target: NodeId,
                ) => void,
            ): void;
            outgoingEdges<EdgeMap, Graph extends EdgeIndexedGraph<EdgeMap>>(
                this: void,
                ctx: GraphDiffContext<Graph>,
                diffEdges: (
                    ctx: GraphDiffContext<Graph>,
                    id: NodeId,
                    lEdges: EdgeMap | undefined,
                    rEdges: EdgeMap | undefined,
                ) => void,
                project?: (edges: EdgeMap) => (...) | (...),
            ): void;
        };
        diffGraphs<G extends DataflowGraph<DataflowGraphVertexInfo, DfEdge>>(
            this: void,
            left: NamedGraph<G>,
            right: NamedGraph<G>,
            config?: Partial<GenericDiffConfiguration>,
        ): GraphDifferenceReport;
        hasComputedArguments(this: void, id: NodeId, graph: DataflowGraph): boolean;
        invertGraph<G extends DataflowGraph<DataflowGraphVertexInfo, DfEdge>>(
            this: void,
            graph: G,
            cleanEnv: REnvironmentInformation,
        ): G;
        isQuoted(
            this: void,
            id: NodeId,
            graph: DataflowGraph,
            withOutgoing?: boolean,
        ): boolean;
        name: "Dataflow";
        origin: (
            this: void,
            dfg: DataflowGraph,
            id: NodeId,
        ) => Origin[] | undefined;
        packagesOf(
            this: void,
            nodes: Iterable<NodeId>,
            graph: DataflowGraph,
            includeBaseR?: boolean,
        ): Set<string>;
        provenance(
            this: void,
            id: NodeId,
            graph: DataflowGraph,
            consider?: ReadonlySet<NodeId>,
            followEdges?: number | undefined,
        ): Set<NodeId>;
        provenanceGraph(
            this: void,
            id: NodeId,
            graph: DataflowGraph,
            consider?: ReadonlySet<NodeId>,
        ): DataflowGraph;
        qualify(
            this: void,
            id: NodeId,
            graph: DataflowGraph,
            qualifyBaseR?: boolean,
        ): Identifier | undefined;
        qualifyAll(
            this: void,
            graph: DataflowGraph,
            qualifyBaseR?: boolean,
        ): ReadonlyMap<NodeId, Identifier | undefined>;
        reaches<G extends DataflowGraph<DataflowGraphVertexInfo, DfEdge>>(
            this: void,
            from: NodeId,
            to: NodeId,
            graph: G,
            knownReachability?: DefaultMap<NodeId, Set<NodeId>>,
        ): boolean;
        reduceAndInvertGraph<
            G extends DataflowGraph<DataflowGraphVertexInfo, DfEdge>,
        >(
            this: void,
            graph: G,
            select: ReadonlySet<NodeId>,
            cleanEnv: REnvironmentInformation,
        ): G;
        reduceGraph<G extends DataflowGraph<DataflowGraphVertexInfo, DfEdge>>(
            this: void,
            graph: G,
            select: ReadonlySet<NodeId>,
            includeMissingTargets?: boolean,
        ): G;
        resolveGraphCriteria<
            G extends DataflowGraph<DataflowGraphVertexInfo, DfEdge>,
        >(
            graph: G,
            ctx: ReadOnlyFlowrAnalyzerContext,
            idMap?: AstIdMap,
        ): G;
        sideEffects: {
            callGraphSummaries: <T>(
                this: void,
                graph: DataflowGraph,
                own: (
                    id: NodeId,
                    fdef: DataflowGraphVertexFunctionDefinition,
                ) => Iterable<(...)>,
            ) => Map<NodeId, Set<(...)>>;
            propagateTransitive: (
                this: void,
                graph: DataflowGraph,
                environment: REnvironmentInformation,
                ctx: FlowrAnalyzerContext,
            ) => {
                environment: REnvironmentInformation;
                escapedNames: Set<(...)>;
                grew: boolean;
            };
        };
        valueIsUsed(this: void, id: NodeId, graph: DataflowGraph): boolean;
        visitDfg(
            this: void,
            graph: DataflowGraph,
            start: NodeId,
            onVertex: (vtx: DataflowGraphVertexInfo) => boolean | void,
        ): void;
        visualize: {
            mermaid: {
                convert(
                    this: void,
                    config: MermaidGraphConfiguration,
                ): { mermaid: MermaidGraph; string: string };
                name: "DataflowMermaid";
                raw(
                    this: void,
                    graph: DataflowGraph<(...), (...)> | DataflowInformation,
                    includeEnvironments?: boolean,
                    mark?: ReadonlySet<(...)>,
                    simplified?: boolean,
                    qualifyBaseR?: boolean,
                ): string;
                url(
                    this: void,
                    graph: DataflowGraph<(...), (...)> | DataflowInformation,
                    includeEnvironments?: boolean,
                    mark?: ReadonlySet<(...)>,
                    simplified?: boolean,
                    qualifyBaseR?: boolean,
                ): string;
            };
            quads: {
                convert: (
                    graph: DataflowGraph,
                    config: QuadSerializationConfiguration,
                ) => string;
            };
        };
    } = ...

    This is the root helper object to work with the DataflowGraph.

    What it used to re-expose under a second name is imported directly instead: DfEdge for the edges, CallGraph for the call-graph view, Resolve for name and value resolution, and DataflowGraph for the graph itself.

    Type Declaration

    • Readonlycreate: {
          empty: (
              this: void,
              cleanEnv?: REnvironmentInformation,
              idMap?: AstIdMap,
          ) => DataflowGraphBuilder<DataflowGraphVertexInfo>;
      }

      Dispatches to helper functions to create new dataflow graphs, e.g. from a pipeline or an empty graph.

    • Readonlydiff: {
          edges<Edge, Graph>(
              this: void,
              ctx: GraphDiffContext<Graph>,
              id: NodeId,
              lEdges: ReadonlyMap<NodeId, Edge> | undefined,
              rEdges: ReadonlyMap<NodeId, Edge> | undefined,
              diffEdge: (
                  edge: Edge,
                  otherEdge: Edge,
                  ctx: GraphDiffContext<Graph>,
                  id: NodeId,
                  target: NodeId,
              ) => void,
          ): void;
          outgoingEdges<EdgeMap, Graph extends EdgeIndexedGraph<EdgeMap>>(
              this: void,
              ctx: GraphDiffContext<Graph>,
              diffEdges: (
                  ctx: GraphDiffContext<Graph>,
                  id: NodeId,
                  lEdges: EdgeMap | undefined,
                  rEdges: EdgeMap | undefined,
              ) => void,
              project?: (edges: EdgeMap) => (...) | (...),
          ): void;
      }

      The pieces a graph comparison is built from, for a view that brings its own edge shape.

      GraphHelper.diffGraphs - which is what you want for two dataflow graphs

      • edges: function
        • Compares the outgoing edges of a single vertex, handing each pair of edges to diffEdge.

          Type Parameters

          • Edge
          • Graph

          Parameters

          Returns void

      • outgoingEdges: function
        • Compares all edges of both graphs vertex by vertex, handing each pair to diffEdges.

          Type Parameters

          Parameters

          • this: void
          • ctx: GraphDiffContext<Graph>
          • diffEdges: (
                ctx: GraphDiffContext<Graph>,
                id: NodeId,
                lEdges: EdgeMap | undefined,
                rEdges: EdgeMap | undefined,
            ) => void
          • Optionalproject: (edges: EdgeMap) => (...) | (...)

          Returns void

    • diffGraphs: function
    • hasComputedArguments: function
      • Whether any argument of the call carries a value the program worked out, rather than only literals the author typed: cat("starting\n") is a log line, cat("n =", length(m)) is a finding. A call among the arguments counts as computed, even one over literals such as paste("a", "b").

        Parameters

        Returns boolean

    • invertGraph: function
    • isQuoted: function
    • Readonlyname: "Dataflow"
    • Readonlyorigin: (this: void, dfg: DataflowGraph, id: NodeId) => Origin[] | undefined

      Returns the origin of a vertex in the dataflow graph

      getOriginInDfg - for the underlying function

    • packagesOf: function
      • The packages the given nodes call into, as Dataflow.qualify resolves every call among them. This is what a selection needs, which is not what the program loads: a library() whose exports the selection never calls does not make the package needed. Base R is left out unless includeBaseR.

        Parameters

        • this: void
        • nodes: Iterable<NodeId>

          the ids to consider, e.g. the result of a slice

        • graph: DataflowGraph

          the graph the ids belong to

        • includeBaseR: boolean = false

          whether to also report base-R packages

        Returns Set<string>

    • provenance: function
      • Given the id of a vertex (usually a variable use), this returns a reachable provenance set by calculating a non-interprocedural and non-context sensitive backward slice, but stopping at the given ids! You can obtain the corresponding graph using Dataflow.reduceGraph.

        Parameters

        • this: void
        • id: NodeId

          The id to use as a seed for provenance calculation

        • graph: DataflowGraph

          The graph to perform the provenance calculation on

        • Optionalconsider: ReadonlySet<NodeId>

          The ids to restrict the calculation too (e.g., the ids contained within a function definition to restrict the analysis to)

        • followEdges: number | undefined = ...

          Which edges to consider in the provenance traversal, if you set this to undefined this will automatically track all edges

        Returns Set<NodeId>

        Dataflow.provenanceGraph - for a convenience wrapper to directly obtain the graph of the provenance.

    • provenanceGraph: function
    • qualify: function
      • The qualified identifier of the call with the given id, or undefined if it does not resolve to a package export and is not itself already namespaced (with purrr loaded, a map() call yields Identifier.make('map', 'purrr'); an explicit pkg::fn() call yields pkg::fn unchanged).

        This is the compact form of Identifier.toQualified, reconstructing both the origins and the call's name from the graph.

        Parameters

        • this: void
        • id: NodeId

          The id of the call to qualify

        • graph: DataflowGraph

          The graph the call is part of

        • qualifyBaseR: boolean = true

          Whether to also qualify a bare base-R call from the package exporting it (sd yields stats::sd), which needs neither a loaded database nor graph edges. Set this to false to only qualify what the origins resolve to (or what is already namespaced).

        Returns Identifier | undefined

    • qualifyAll: function
      • The qualified name of every call of the graph, undefined for the calls that do not qualify. Prefer this over asking call by call: it resolves each call once for both qualifyBaseR variants.

        Parameters

        Returns ReadonlyMap<NodeId, Identifier | undefined>

    • reaches: function
    • reduceAndInvertGraph: function
    • reduceGraph: function
      • Only returns the sub-part of the graph that is determined by the given selection. In other words, this will return a graph with only vertices that are part of the selected ids, and edges that are between such selected vertices.

        Type Parameters

        Parameters

        • this: void
        • graph: G

          the dataflow graph to slice for

        • select: ReadonlySet<NodeId>

          the ids to select in the reduced graph

        • includeMissingTargets: boolean = false

          if set to true, this will include edges which target vertices that are not selected!

        Returns G

    • resolveGraphCriteria: function
    • ReadonlysideEffects: {
          callGraphSummaries: <T>(
              this: void,
              graph: DataflowGraph,
              own: (
                  id: NodeId,
                  fdef: DataflowGraphVertexFunctionDefinition,
              ) => Iterable<(...)>,
          ) => Map<NodeId, Set<(...)>>;
          propagateTransitive: (
              this: void,
              graph: DataflowGraph,
              environment: REnvironmentInformation,
              ctx: FlowrAnalyzerContext,
          ) => {
              environment: REnvironmentInformation;
              escapedNames: Set<(...)>;
              grew: boolean;
          };
      }

      Interprocedural propagation of escaped side effects (attached packages, <<- definitions) to their callers.

    • valueIsUsed: function
      • Whether the call's result is passed on -- assigned, handed to another call, returned -- rather than left for R to auto-print. A bare anova(a, b) is an output the program reports; the summary(m) of x <- summary(m) is not.

        Only an edge that carries the value counts. A plain EdgeType.Reads does not: it also chains the calls that share a side effect, which would report plot(x) as consumed by the lines(y) drawn after it.

        Parameters

        Returns boolean

    • visitDfg: function
      • A simple visitor akin to RNode.visitAst to traverse the dataflow graph starting from the start id and only respecting edge direction.

        Parameters

        • this: void
        • graph: DataflowGraph

          The dataflow graph to operate on.

        • start: NodeId

          The start id of the visitation.

        • onVertex: (vtx: DataflowGraphVertexInfo) => boolean | void

          The function to execute for each vertex, if this returns true the visitation will stop from this vertex.

        Returns void

    • Readonlyvisualize: {
          mermaid: {
              convert(
                  this: void,
                  config: MermaidGraphConfiguration,
              ): { mermaid: MermaidGraph; string: string };
              name: "DataflowMermaid";
              raw(
                  this: void,
                  graph: DataflowGraph<(...), (...)> | DataflowInformation,
                  includeEnvironments?: boolean,
                  mark?: ReadonlySet<(...)>,
                  simplified?: boolean,
                  qualifyBaseR?: boolean,
              ): string;
              url(
                  this: void,
                  graph: DataflowGraph<(...), (...)> | DataflowInformation,
                  includeEnvironments?: boolean,
                  mark?: ReadonlySet<(...)>,
                  simplified?: boolean,
                  qualifyBaseR?: boolean,
              ): string;
          };
          quads: {
              convert: (
                  graph: DataflowGraph,
                  config: QuadSerializationConfiguration,
              ) => string;
          };
      }

      Maps to the mermaid-centric visualization helper for dataflow graphs and their views

      • Readonlymermaid: {
            convert(
                this: void,
                config: MermaidGraphConfiguration,
            ): { mermaid: MermaidGraph; string: string };
            name: "DataflowMermaid";
            raw(
                this: void,
                graph: DataflowGraph<(...), (...)> | DataflowInformation,
                includeEnvironments?: boolean,
                mark?: ReadonlySet<(...)>,
                simplified?: boolean,
                qualifyBaseR?: boolean,
            ): string;
            url(
                this: void,
                graph: DataflowGraph<(...), (...)> | DataflowInformation,
                includeEnvironments?: boolean,
                mark?: ReadonlySet<(...)>,
                simplified?: boolean,
                qualifyBaseR?: boolean,
            ): string;
        }

        Mermaid rendering helper for dataflow graphs

        • convert: function
        • Readonlyname: "DataflowMermaid"
        • raw: function
        • url: function
          • Converts a dataflow graph to a mermaid url that visualizes the graph. This is basically a combination of DataflowMermaid.raw and Mermaid.codeToUrl.

            Parameters

            • this: void
            • graph: DataflowGraph<(...), (...)> | DataflowInformation

              the dataflow graph to render

            • OptionalincludeEnvironments: boolean

              whether to include the environment content in the output

            • Optionalmark: ReadonlySet<(...)>

              which vertices to highlight in the visualization

            • simplified: boolean = false

              whether to show a simplified use of the graph with fewer details on the vertices and edges

            • qualifyBaseR: boolean = true

              show the edge-free base-R qualification (stats::acf); false when the signature database is disabled

            Returns string

      • Readonlyquads: {
            convert: (
                graph: DataflowGraph,
                config: QuadSerializationConfiguration,
            ) => string;
        }
    Dataflow.origin(graph, id);                  // where the use at `id` comes from
    DfEdge.includesType(edge, EdgeType.Reads); // the edge helpers
    Dataflow.visualize.mermaid.url(graph); // a link to the rendered graph