Giter Club home page Giter Club logo

the-ripple-spreading-algorithm-for-the-many-to-many-shortest-path-problem's Introduction

The Ripple-Spreading Algorithm for the Many-to-Many Shortest Path Problem

Reference: Hu X B, Wang M, Leeson M S, et al. Deterministic agent-based path optimization by mimicking the spreading of ripples[J]. Evolutionary Computation, 2016, 24(2): 319-346.

The many-to-many shortest path problem has a set of source nodes as well as a set of destination nodes, and its goal is, for every source node, to find the associated shortest path connecting to one node; it does not matter which one, in the destination set.

Variables Meaning
network Dictionary, {node1: {node2: length, node3: length, ...}, ...}
source The set of source nodes
destination The set of destination nodes
nn The number of nodes
neighbor Dictionary, {node1: [the neighbor nodes of node1], ...}
v The ripple-spreading speed (i.e., the minimum length of arcs)
t The simulated time index
nr The number of ripples - 1
epicenter_set List, the epicenter node of the ith ripple is epicenter_set[i]
path_set List, the path of the ith ripple from the source node to node i is path_set[i]
length_set List, the length of the path of the ith ripple (i.e., path_set[i])
radius_set List, the radius of the ith ripple is radius_set[i]
active_set List, active_set contains all active ripples
Omega Dictionary, Omega[n] = i denotes that ripple i is generated at node n

Example

The source nodes are nodes 1, 3, and 5, and the destination nodes are nodes 0 and 6.

if __name__ == '__main__':
    test_network = {
        0: {1: 10, 2: 1},
        1: {0: 10, 3: 2, 4: 9},
        2: {0: 1, 3: 3, 5: 2},
        3: {1: 2, 2: 3, 4: 5, 5: 6},
        4: {1: 9, 3: 5, 6: 4},
        5: {2: 2, 3: 6, 6: 9},
        6: {4: 4, 5: 9},
    }
    source_nodes = [1, 3, 5]
    destination_nodes = [0, 6]
    print(main(test_network, source_nodes, destination_nodes))
Output:
{
    1: {'path': [1, 3, 2, 0], 'length': 6}, 
    3: {'path': [3, 2, 0], 'length': 4}, 
    5: {'path': [5, 2, 0], 'length': 3},
}

the-ripple-spreading-algorithm-for-the-many-to-many-shortest-path-problem's People

Contributors

xavier-mayiming avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.