This program calculates the cost of setting up a network based on the given specifications and rate cards. Gigaclear focuses on putting cables in the ground, connecting pots to a central cabinet via cables buried in trenches and chambers. The cost of setting up the network is based on predefined rate cards.
- Python 3.x
- NetworkX library (for handling and processing graphs)
To install NetworkX:
pip install networkx
- Navigate to the
src
directory:
cd path/to/src
- Run the program:
python3 gigaclear_calculator.py
- You'll be prompted to enter the path to the
.graphml
file containing the network specifications. Provide the relative or absolute path to the file:
Enter the path to the graphml file: ../data/problem.graphml
- The program will display the calculated cost for the network setup based on the two rate cards.
- RateCard Class: This class represents a rate card and has methods to calculate costs based on the given parameters.
- load_graphml Function: Reads a
.graphml
file and returns a graph. - extract_data Function: Extracts necessary data from the graph, such as total cable lengths, number of chambers, and pots.
- main Function: Main driver function that integrates the above functions and calculates costs.
The program includes a basic test to ensure the calculate_cost
method works correctly. More tests can be added to validate other functionalities and edge cases.
- Handling of more edge cases, e.g., missing attributes in the
.graphml
file. - Support for more file formats beyond
.graphml
. - A more interactive UI/CLI for enhanced user experience.
- Expansion of test cases for robust validation.