CallGraphForest
Class for call graph forests.
A call graph forest represents a collection of call graph trees.
Attributes:
| Name | Type | Description |
|---|---|---|
graphs |
dict[NodeID, CallGraphNode]
|
The dictionary of call graph trees. The key is the name of the tree, the value is the root CallGraphNode of the tree. |
Source code in src/library_analyzer/processing/api/purity_analysis/model/_call_graph.py
graphs: dict[NodeID, CallGraphNode] = field(default_factory=dict)
class-attribute
instance-attribute
¶
__init__(graphs=dict())
¶
add_graph(graph_id, graph)
¶
Add a call graph tree to the forest.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
graph_id |
NodeID
|
The NodeID of the tree node. |
required |
graph |
CallGraphNode
|
The root of the tree. |
required |
Source code in src/library_analyzer/processing/api/purity_analysis/model/_call_graph.py
delete_graph(graph_id)
¶
Delete a call graph tree from the forest.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
graph_id |
NodeID
|
The NodeID of the tree to delete. |
required |
Source code in src/library_analyzer/processing/api/purity_analysis/model/_call_graph.py
get_graph(graph_id)
¶
Get a call graph tree from the forest.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
graph_id |
NodeID
|
The NodeID of the tree node to get. |
required |
Raises:
| Type | Description |
|---|---|
KeyError
|
If the graph_id is not in the forest. |
Source code in src/library_analyzer/processing/api/purity_analysis/model/_call_graph.py
has_graph(graph_id)
¶
Check if the forest contains a call graph tree with the given NodeID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
graph_id |
NodeID
|
The NodeID of the tree to check for. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if the forest contains a tree with the given NodeID, False otherwise. |