Easy_rider
 
Loading...
Searching...
No Matches
HighwayGenerator Class Reference

Builds a minimum spanning tree (Kruskal) over all intersections — Highway generator. More...

#include <HighwayGenerator.h>

Inheritance diagram for HighwayGenerator:
Collaboration diagram for HighwayGenerator:

Public Member Functions

 HighwayGenerator (int defaultSpeed)
 
void generate (Graph< Intersection, Road > &graph) override
 Append new bidirectional highways into the graph (no duplicates).
 

Additional Inherited Members

- Static Protected Member Functions inherited from RoadGenerator
static double euclid (const Intersection &a, const Intersection &b)
 Compute the Euclidean distance between two intersections.
 

Detailed Description

Builds a minimum spanning tree (Kruskal) over all intersections — Highway generator.

Note
This implementation deviates from the standard Kruskal algorithm by enforcing a planar constraint: edges are only added when both directed variants (A->B and B->A) can be inserted without crossing existing roads. As a result, it does not always produce the exact minimum spanning tree as returned by a pure Kruskal run.

Constructor & Destructor Documentation

◆ HighwayGenerator()

HighwayGenerator::HighwayGenerator ( int  defaultSpeed)
explicit
Parameters
defaultSpeedSpeed for every new Road.

Member Function Documentation

◆ generate()

void HighwayGenerator::generate ( Graph< Intersection, Road > &  graph)
overridevirtual

Append new bidirectional highways into the graph (no duplicates).

Implements RoadGenerator.


The documentation for this class was generated from the following files: