Skip to content

SPFA algorithm added #34

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 2, 2014
Merged

SPFA algorithm added #34

merged 2 commits into from
Jun 2, 2014

Conversation

shuding
Copy link
Contributor

@shuding shuding commented May 31, 2014

Add SPFA algorithm and tests :P

From Wikipedia:

Shortest Path Faster Algorithm (SPFA) is an improvement of the Bellman–Ford algorithm which computes single-source shortest paths in a weighted directed graph.

procedure Shortest-Path-Faster-Algorithm(G, s)
1    for each vertex v ≠ s in V(G)
2        d(v) := ∞
3    d(s) := 0
4    offer s into Q
5    while Q is not empty
6        u := poll Q
7        for each edge (u, v) in E(G)
8            if d(u) + w(u, v) < d(v) then
9                d(v) := d(u) + w(u, v)
10                if v is not in Q then
11                    offer v into Q

@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling ba02bd0 on quietshu:master into c660898 on felipernb:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.19%) when pulling 4b3b8f7 on quietshu:master into c660898 on felipernb:master.

felipernb added a commit that referenced this pull request Jun 2, 2014
@felipernb felipernb merged commit 4350b94 into felipernb:master Jun 2, 2014
@felipernb
Copy link
Owner

Thanks! 🍺

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants