Giter VIP home page Giter VIP logo

gamma's People

Contributors

rapodaca avatar wiebecnossen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

gamma's Issues

What happened to the generics?

I'm puzzled, because gamma 0.5 defined the Graph trait as generic over node and edge type. StableGraph had similar generic parameters. But now in 0.8, those are all gone, and nodes seem to be hardcoded as usize, even in the Graph trait as well as in DefaultGraph.

I'm wondering what drove this change and what the recommended practice is to use gamma when the nodes are not usize?

Thanks!

graphcore vs. petgraph?

It would be nice if you could explain any advantages you see of your crate over the long-standing petgraph crate. (Or, is it just your own attempt for the sake of learning?)

How to construct and return a HashGraph from a function?

How do you do this when you do not hard code literals. For my crate blossom I generate random graphs like this:

    fn random_graph<'a>(size: usize, rng: &mut dyn RngCore) -> HashGraph<'a, usize, ()> {
        let nodes: Vec<_> = (0..size).collect();
        let mut edges = vec![];
        
        // Generate some random edges
        for i in 0..size {
            let mut j = i + 1;
            while j < size {
                let interval = size + 1 - j;
                let p = (rng.next_u64() as usize) % interval + j;
                if p < size {
                    edges.push((nodes.index(i), nodes.index(p), ()));
                }
                j = p + 1;
            }
        }

        // error[E0505]: cannot move out of `nodes` because it is borrowed
        HashGraph::build(nodes, edges).unwrap()
    }

which gives the indicated error message. If you do not intend to return the graph, you can change the last line to

        let graph = HashGraph::build(nodes.clone(), edges).unwrap();

However when you want to return graph you get

error[E0515]: cannot return value referencing local variable `nodes`

Using new(), add_node() and add_edge() I run into similar problems. An example of how to do this would be very welcome.

Graph API nodes() should be an iterator?

I am implementing a BTreeMap/Set-backed graph. I noticed that the nodes() method returns a slice of usize (&[usize]). This operation doesn't work very nicely for any graph that's not internally stored as a vector -- I imagine I would have to manually assemble a slice by iterating through the entire graph. I wonder if nodes() should instead return an iterator of usize to allow for flexibility in implementations.

Existing code that uses nodes() as a slice can probably be trivially migrated by calling .collect() on the iterator.

Edit: Okay, so it looks like I rediscovered the reason why nodes() & edges() might not be an iterator -- no painless way to return a generic Iterator from trait methods because Generic Associated Types isn't implemented yet. It still isn't very nice to return a slice from a usability perspective so I suppose I will poke around a bit and see if I can get some form of iterator working.

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.