News for hackers. Stuff that matters.
Re:New Query Language for Graph Databases to Become Internat... by seanhunter on Wednesday September 18, 2019 @10:50AM (#21005993)
This is an elegant and simple formulation of the problem and shows how bad SQL is at this. However, you can do this in SQL.

    with recursive bacon_movies as (
        select
            a.id as actor_id
            , 0 as bacon_degree
        from
            actors a
        where
            a.name = 'Kevin Bacon'
        union
        select
            r1.actor_id
            , b.bacon_degree + 1 as bacon_degree
        from
            bacon_movies b
        join roles r on r.actor_id = b.actor_id
        join roles r1 on r.movie_id = r1.movie_id and r1.actor_id <> b.actor_id
        where b.bacon_degree < 6
    )
    select
        a.name
        , min(b1.bacon_degree) as bacon_degree
    from bacon_movies b1
    join actors a on a.id = b1.actor_id
    group by a.name
    order by bacon_degree asc;
...not saying it's a good way to do this
Re:New Query Language for Graph Databases to Become Internat... by taffer on Wednesday September 18, 2019 @02:21PM (#21008351)
> ...not saying it's a good way to do this

It really depends. If you do these kinds of queries all the time, it's a good idea to use a graph DB, but if these queries are rare, it often doesn't make sense to add a new technology to your project.

Re:New Query Language for Graph Databases to Become Internat... by bcoates on Wednesday September 18, 2019 @03:34PM (#21009113)
Maybe I have the brainworms from too much SQL but that seems pretty fine? It's an idiomatic CTE that more or less directly translates back to the problem statement. (nitpick: I'd exclude already-found rows from the union to do shortest-path in the CTE instead of doing it later)
Re:New Query Language for Graph Databases to Become Internat... by tossAfterUsing on Wednesday September 18, 2019 @02:07PM (#21008201)
jfc... sql :(

i've written thousands of lines of cypher queries. i just can't do sql though, it's not like i refuse either... it's that my brain just doesn't get it.

practice would surely help. i took an intro class once, and that improved my skills a lot (i.e. 0 -> 0.1)... teaching about the math of what's being done and giving me some ways to think about it... but it all just seems so incredibly tedious.