スキル一覧に戻る
tonyoconnell

memgraph-aco-queries

by tonyoconnell

2🍴 0📅 2025年12月25日
GitHubで見るManusで実行

SKILL.md


name: memgraph-aco-queries description: Query and analyze ACO pheromone graphs in Memgraph. Use for prime candidate queries, pheromone analysis, path validation, and convergence monitoring. allowed-tools: Bash, Read, Grep, Glob

Memgraph ACO Operations

Connection

from gqlalchemy import Memgraph
mg = Memgraph(host="localhost", port=7687)

Schema

// Nodes
(:PrimeCandidate {value: INT, fitness: FLOAT, visits: INT, is_factor: BOOL})
(:Target {n: INT, sqrt_n: FLOAT, found: BOOL})

// Edges
[:TRAIL {pheromone: FLOAT, updated: TIMESTAMP}]

// Indexes
CREATE INDEX ON :PrimeCandidate(value);
CREATE INDEX ON :PrimeCandidate(fitness);

Common Queries

Initialize prime candidates

UNWIND $primes AS p
CREATE (:PrimeCandidate {value: p, fitness: 0.0, visits: 0, is_factor: false})

Deposit pheromone

MATCH (p:PrimeCandidate {value: $prime})
SET p.fitness = CASE WHEN p.fitness < $strength THEN $strength ELSE p.fitness END,
    p.visits = p.visits + 1

Global evaporation

MATCH ()-[t:TRAIL]->()
SET t.pheromone = GREATEST(0.01, t.pheromone * 0.95)

Get pheromone-weighted candidates

MATCH (p:PrimeCandidate)-[t:TRAIL]->(next)
WHERE p.value = $current
RETURN next.value, t.pheromone
ORDER BY t.pheromone DESC
LIMIT 10

Find high-pheromone paths

MATCH path = (start:PrimeCandidate)-[t:TRAIL*1..5]->(end:PrimeCandidate)
WHERE ALL(r IN relationships(path) WHERE r.pheromone > 0.5)
RETURN path, reduce(s = 0, r IN relationships(path) | s + r.pheromone) AS total
ORDER BY total DESC
LIMIT 10

Mark factor found

MATCH (p:PrimeCandidate {value: $factor})
SET p.is_factor = true, p.fitness = 1.0

Convergence check

MATCH (p:PrimeCandidate)
WHERE p.fitness > 0.8
RETURN count(p) AS hot_candidates, avg(p.fitness) AS avg_fitness

スコア

総合スコア

50/100

リポジトリの品質指標に基づく評価

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

0/10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

レビュー

💬

レビュー機能は近日公開予定です