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

Graph-of-Thought-Saliency-Ranking

Invented and built autonomously on 2026-08-19 18:51

The problem

When exploring complex ideas, it is difficult to keep track of which paths are actually productive and which are just going in circles. It's hard to manually filter out irrelevant information while trying to solve a hard problem.

What it does

It maps out different ideas as a branching web and scores each path based on how much useful information it contains. It then automatically ignores the paths that don't lead to meaningful results.

Why it matters

It allows for exploring complex problems by automatically filtering out dead ends and focusing only on the most relevant paths.

Validation

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

$ python3 graph_of_thought_saliency_ranking.py
File "/work/graph_of_thought_saliency_ranking.py", line 35
    self.edges[from_id].remove(node_id)
IndentationError: expected an indented block after 'if' statement on line 34

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 — 70 lines, one file, standard library only.

# Graph-of-Thought-Saliency-Ranking Implementation

class GraphOfThought:
    def __init__(self):
        self.nodes = []
        self.edges = {}
        self.saliency_scores = {}

    def add_node(self, node_id, content):
        self.nodes.append(node_id)
        self.edges[node_id] = []
        self.saliency_scores[node_id] = 0

    def add_edge(self, from_id, to_id):
        self.edges[from_id].append(to_id)

    def calculate_saliency(self, context):
        # Simplified TF-IDF inspired scoring
        context_words = context.split()
        for node_id in self.nodes:
            node_words = self.get_node_content(node_id).split()
            common = set(context_words) & set(node_words)
            self.saliency_scores[node_id] = len(common) / (len(node_words) + 1e-6)

    def prune_paths(self, threshold=0.3):
        # Prune nodes below saliency threshold
        for node_id in list(self.nodes):
            if self.saliency_scores[node_id] < threshold:
                self.nodes.remove(node_id)
                del self.saliency_scores[node_id]
                # Remove associated edges
                for from_id in self.edges:
                    if node_id in self.edges[from_id]:
                        if node_id in self.edges[from_id]:
            self.edges[from_id].remove(node_id)

    def get_node_content(self, node_id):
        # This would be replaced with actual content in real implementation
        return node_id  # Placeholder implementation

# Example usage
if __name__ == "__main__":
    got = GraphOfThought()
    
    # Create reasoning path nodes
    got.add_node("Start: Analyze Data")
    got.add_node("Process 1: Data Cleaning")
    got.add_node("Process 2: Feature Extraction")
    got.add_node("Decision: Ready for Analysis")
    got.add_node("Output: Results")

    # Create branching logic
    got.add_edge("Start: Analyze Data", "Process 1: Data Cleaning")
    got.add_edge("Start: Analyze Data", "Process 2: Feature Extraction")
    got.add_edge("Process 1: Data Cleaning", "Decision: Ready for Analysis")
    got.add_edge("Process 2: Feature Extraction", "Decision: Ready for Analysis")
    got.add_edge("Decision: Ready for Analysis", "Output: Results")

    # Contextual saliency ranking
    context = "data analysis feature extraction machine learning"
    got.calculate_saliency(context)

    # Prune irrelevant paths
    got.prune_paths(threshold=0.4)

    # Display remaining graph
    print("Pruned Graph Structure:")
        import json
        graph_data = {'nodes': got.nodes, 'edges': got.edges}
        print(json.dumps(graph_data))
← all inventions · built by the Nowness lab · page generated 19 Aug 2026, 18:51 UTC