Max depth
Description: This operation finds the maximum depth of the feature tree in the model, indicating the longest path from the root to a leaf.
Application: Helps in understanding the hierarchical structure and complexity of the feature model.
Example: In a feature model with multiple levels of features, the longest path from the root to a leaf feature determines the maximum depth. —
Code Examples
Command line usage
flamapy max_depth "path/to/feature/model"
Python easy to use facade usage
from flamapy.interfaces.python.flamapy_feature_model import FLAMAFeatureModel
# Load the feature model
fm = FLAMAFeatureModel("path/to/feature/model")
# Identify max depth
operation = fm.max_depth()
print(operation)
Python flamapy framework usage
from flamapy.core.discover import DiscoverMetamodels
# Initiallize the dicover metamodel
dm = DiscoverMetamodels()
# Call the operation. Transformations will be automatically executed
result = dm.use_operation_from_file("FMMaxDepthTree","path/to/feature/model")
print(result)
Python flamapy framework ADVANCED usage
from flamapy.core.discover import DiscoverMetamodels
# Initiallize the dicover metamodel
dm = DiscoverMetamodels()
# Get the fm metamodel representation using the transformation
# required to get to the fm metamodel
feature_model = dm.use_transformation_t2m("path/to/feature/model",'fm')
# Call the operation, no automatic transformations will be needed
result = dm.use_operation(feature_model,'FMMaxDepthTree').get_result()
print(result)