7.4.1. Accessing the RFG

Import the bauhaus.rfg module to use the RFG library (see Listing Importing the rfg part of bauhaus).

Importing the rfg part of bauhaus
from bauhaus import rfg

You can also import the classes directly to avoid prefixing them with rfg (see Listing Importing only the used classes from the rfg part of bauhaus).

Importing only the used classes from the rfg part of bauhaus
from bauhaus import rfg

# import the classes you need
from bauhaus.rfg import Graph, View, Edge, Node

To keep namespaces clean, we recommend using from bauhaus import rfg and qualifying the classes with rfg.

The RFG interface features the following Python classes:

Graph

The RFG graph summarizes all facts about a system under analysis that can be modeled as a graph. A graph contains views, which in turn contain nodes and edges. Attributes can be attached to the graph. A graph can be created, loaded, and saved. See Section Class Graph for more details.

View

A view is a subgraph of the graph. A view has a name and contains nodes and edges. Attributes can be attached to a view. A view can be created, loaded, and saved as a GXL file. See Section Class View for more details.

Node

A node represents an entity of the analyzed system, either a source artifact or an element added during analysis. A node has a type. It can be contained in several views. A node can only be contained in one graph. Attributes can be attached to a node. See Section Class Node for more details.

Edge

An edge represents a relationship between entities of the analyzed system. An edge has a type. An edge can be contained in several views. An edge can only be contained in one graph. If it is contained in a view, its source and target nodes must also be contained in that view. Attributes can be attached to an edge. See Section Class Edge for more details.

NodeSet

A set of nodes. The nodes can be from different views and even different graphs. See Section Class NodeSet for more details.

EdgeSet

A set of edges. The edges can be from different views and even different graphs. See Section Class EdgeSet for more details.

GraphAttribute

A graph attribute can be attached to a graph. It has a name and an optional value. An attribute is typed. The type is one of “toggle”, “int”, “float”, or “string”. A graph attribute is graph-specific. See Section Attribute Classes: GraphAttribute, ViewAttribute, NodeAttribute, and EdgeAttribute for more details.

ViewAttribute

A view attribute can be attached to a view. Other characteristics can be found in the explanation of graph attributes. See Section Attribute Classes: GraphAttribute, ViewAttribute, NodeAttribute, and EdgeAttribute for more details.

NodeAttribute

A node attribute can be attached to a node. Other characteristics can be found in the explanation of graph attributes. See Section Attribute Classes: GraphAttribute, ViewAttribute, NodeAttribute, and EdgeAttribute for more details.

EdgeAttribute

An edge attribute can be attached to an edge. Other characteristics can be found in the explanation of graph attributes. See Section Attribute Classes: GraphAttribute, ViewAttribute, NodeAttribute, and EdgeAttribute for more details.

NodeType

A node has a node type. A node type has a name. A node type can have a parent node type and derived node types. Node types are graph-specific. See Section Type Classes: NodeType and EdgeType for more details.

EdgeType

An edge has an edge type. An edge type can have a parent edge type and derived edge types. Edge types are graph-specific. See Section Type Classes: NodeType and EdgeType for more details.

All functions of the bauhaus.rfg interface module are described from the perspective of an RFG library user. Some functions can handle additional parameter types; however, these are for internal library implementation purposes and should not be used by the user.

Caution

Ensure you do not rely on functionality that goes beyond the interface shown here. If you examine the actual implementation, be advised that details may change without notice.