@eagleoutice/flowr
Version:
Static Dataflow Analyzer and Program Slicer for the R Programming Language
58 lines (57 loc) • 3.58 kB
TypeScript
import { DataflowGraph } from './graph';
import type { DataflowGraphVertexFunctionCall, DataflowGraphVertexFunctionDefinition } from './vertex';
import type { REnvironmentInformation } from '../environments/environment';
import { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
import { DefaultMap } from '../../util/collections/defaultmap';
/**
* A call graph is a dataflow graph where all vertices are function calls.
* You can create a call graph from a dataflow graph using {@link CallGraph.compute}.
* If you want to extract a sub call graph, use {@link CallGraph.computeSubCallGraph}.
* @see {@link dropTransitiveEdges} - to reduce the call graph by dropping transitive edges
*/
export type CallGraph = DataflowGraph<Required<DataflowGraphVertexFunctionCall | DataflowGraphVertexFunctionDefinition>>;
export interface State {
visited: Set<NodeId>;
potentials: [NodeId, Set<NodeId>][];
}
/**
* Helper object for call-graphs, you can compute new call graphs based on {@link CallGraph.compute}.
* @see {@link Dataflow}
* @see {@link CallGraph}
*/
export declare const CallGraph: {
/**
* Extracts the sub call graph from the given call graph, starting from the given entry points.
*/
readonly computeSubCallGraph: (this: void, graph: CallGraph, entryPoints: Set<NodeId>) => CallGraph;
/**
* Reduces the call graph by dropping all transitive edges.
*/
readonly dropTransitiveEdges: (this: void, graph: CallGraph) => CallGraph;
/**
* Computes the call graph from the given dataflow graph.
* @see {@link CallGraph} - for details
* @see {@link CallGraph.computeSubCallGraph} - to extract sub call graphs
* @see {@link CallGraph.dropTransitiveEdges} - to reduce the call graph by dropping transitive edges
*/
readonly compute: (this: void, graph: DataflowGraph) => CallGraph;
readonly visualize: {
readonly mermaid: {
readonly name: "DataflowMermaid";
readonly convert: (this: void, config: import("../../util/mermaid/dfg").MermaidGraphConfiguration) => {
string: string;
mermaid: import("../../util/mermaid/dfg").MermaidGraph;
};
readonly raw: (this: void, graph: DataflowGraph | import("../info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<NodeId>, simplified?: boolean) => string;
readonly url: (this: void, graph: DataflowGraph | import("../info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<NodeId>, simplified?: boolean) => string;
};
readonly quads: {
readonly convert: typeof import("./quads").df2quads;
};
};
readonly diffGraphs: <G extends DataflowGraph>(this: void, left: import("../../util/diff-graph").NamedGraph<G>, right: import("../../util/diff-graph").NamedGraph<G>, config?: Partial<import("../../util/diff").GenericDiffConfiguration>) => import("../../util/diff-graph").GraphDifferenceReport;
readonly invertGraph: <G extends DataflowGraph>(this: void, graph: G, cleanEnv: REnvironmentInformation) => G;
readonly resolveGraphCriteria: <G extends DataflowGraph>(graph: G, ctx: import("../../project/context/flowr-analyzer-context").ReadOnlyFlowrAnalyzerContext, idMap?: import("../../r-bridge/lang-4.x/ast/model/processing/decorate").AstIdMap) => G;
readonly reaches: <G extends DataflowGraph>(this: void, from: NodeId, to: NodeId, graph: G, knownReachability?: DefaultMap<NodeId, Set<NodeId>>) => boolean;
readonly name: "CallGraph";
};