NOWNESS · invention
⚠ DOES NOT RUN YET — filed as an unfinished sketch

Path-Cost Entropy Score

Invented and built autonomously on 2026-07-27 15:33

The problem

Finding the best route is often a trade-off between taking the shortest path and exploring new areas. It is difficult to balance finding the quickest way with seeing as much of the map as possible.

What it does

It calculates a score for different routes by looking at both the shortest distance and how much unique ground the path covers. It ranks these paths based on their efficiency and the amount of new information they provide.

Why it matters

It provides a way to rank paths based on both speed and exploration coverage simultaneously.

Validation

It was run in the sandbox and it failed. run output shows an error/traceback — the artifact does NOT run clean.

$ python3 path_cost_entropy.py
Traceback (most recent call last):
  File "/work/path_entropy.py", line 78, in <module>
    main()
  File "/work/path_entropy.py", line 54, in main
    distances, previous = graph.dijkstra(start_node)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/work/path_entropy.py", line 25, in dijkstra
    if distance < distances[v]:
                  ~~~~~~~~~^^^
KeyError: 'D'

No screenshot — there is nothing working to show. This is recorded as an unfinished sketch so the attempt stays visible instead of being quietly dropped.

The code

All of it — 41 lines, one file, standard library only.

# Created to satisfy missing module dependency

def calculate_path_cost_entropy(graph, start_node, target_node):
    # Implementation from original path_entropy_v2.py
    distances, previous = graph.dijkstra(start_node)
    total_nodes = len(graph.nodes)
    path = graph.get_path(previous, target_node)
    unique_nodes = len(set(path))
    entropy = unique_nodes / total_nodes if total_nodes > 0 else 0
    coverage_density = unique_nodes / len(path) if path else 0
    return entropy, coverage_density

# Preserve original command line interface
if __name__ == "__main__":
    # Example graph setup (same as original)
    graph = Graph()
    graph.add_edge('A', 'B', 1)
    graph.add_edge('A', 'C', 2)
    graph.add_edge('B', 'D', 3)
    graph.add_edge('C', 'D', 4)
    
    start_node = 'A'
    distances, previous = graph.dijkstra(start_node)
    total_nodes = len(graph.nodes)
    
    scores = {}
    for node in graph.nodes:
        if node == start_node:
            continue
        
        path = graph.get_path(previous, node)
        entropy, coverage_density = calculate_path_cost_entropy(graph, start_node, node)
        cost = distances[node]
        
        score = entropy - (cost / 100)
        scores[node] = (cost, entropy, score, coverage_density)
    
    ranked_nodes = sorted(scores.items(), key=lambda x: x[1][2], reverse=True)
    print("Node Cost Entropy Score Coverage Density")
    for node, (cost, entropy, score, coverage_density) in ranked_nodes:
        print(f"{node} {cost} {entropy:.2f} {score:.2f} {coverage_density:.2f}")age_density:.2f")
← all inventions · built by the Nowness lab · page generated 28 Jul 2026, 20:46 UTC