Click here to Skip to main content
14,575,959 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.
 
GeneralRe: Period, New Paragraph Pin
Mark_Wallace9-Feb-20 20:52
MemberMark_Wallace9-Feb-20 20:52 
GeneralRe: Period, New Paragraph Pin
Jörgen Andersson9-Feb-20 21:05
professionalJörgen Andersson9-Feb-20 21:05 
AnswerRe: Period, New Paragraph Pin
the goat in your machine9-Feb-20 22:00
Memberthe goat in your machine9-Feb-20 22:00 
GeneralRe: Period, New Paragraph Pin
DerekT-P9-Feb-20 23:22
professionalDerekT-P9-Feb-20 23:22 
GeneralRe: Period, New Paragraph Pin
Gerry Schmitz10-Feb-20 2:38
mveGerry Schmitz10-Feb-20 2:38 
GeneralRe: Period, New Paragraph Pin
dandy7210-Feb-20 4:09
Memberdandy7210-Feb-20 4:09 
GeneralRe: Period, New Paragraph Pin
RedDk10-Feb-20 8:13
MemberRedDk10-Feb-20 8:13 
Generalhaving some fun looking into graph databases I Pin
BillWoodruff9-Feb-20 18:29
mveBillWoodruff9-Feb-20 18:29 
I have been examining Neo4j's implementation (Java engine, .NET/C# driver available). I have to control my knee-jerk "oohh ... alien" prejudice against Java technology.

The free book "Graph Databases," by Neo4j principals Robinson, et. al., published by O'Reilly, is an excellent overview of gdb's in general as well as Neo4j implementation features: download here [^].

So far all of the graph db's I've looked at implement connections (edges, links) between object (vertices, nodes) as one-way, which interests me since I am interested in modeling reciprocal relationships; the C# prototype I implemented for fun is based on two-way connections with each direction having a "strength," and dynamic interacting functions used, so ... when one direction changes strength ... the other direction's strength is modified (of course, two-way reciprocity demands preventing runaway recursion).

Neo4j defines Properties as "first class" objects, and they can be attached to either nodes, or connections: I really like that.

Here's an example, in Neo4j's query language, Cypher, that selects friends of friends of a selected person who are not immediate first-level friends of the person:
// given a data source like:

var people = new List<string[]>
{
    new[] {"Jim", "Mike"}, new[] {"Jim", "Billy"}, new[] {"Anna"Neo4j, "Jim"},
    new[] {"Anna", "Mike"}, new[] {"Sally", "Anna"}, new[] {"Joe", "Sally"},
    new[] {"Joe", "Bob"}, new[] {"Bob", "Sally"}
};
Cypher code executed by Neo4j engine:
MATCH 
  (person:Person)-[:KNOWS]-(friend:Person)-[:KNOWS]-
  (foaf:Person)
WHERE 
  person.name = "Joe"
  AND NOT (person)-[:KNOWS]-(foaf)
RETURN
  foaf
You can see this code in a complete C# example here: [^].

Well, I find the Cypher syntax very weird, but, I never completed SQL potty-training OMG | :OMG: I sat down and toyed with what I would do using Linq (which I am sure can be improved) to handle such a query, came up with this:
List<(string p1Name, string p2Name)> people = new List<(string, string)>
{
    ("Jim", "Mike"), ("Jim", "Billy"), ("Jim", "Jonas"), ("Anna", "Jim"),
    ("Anna", "Mike"), ("Sally", "Anna"), ("Joe", "Sally"),
    ("Joe", "Bob"), ("Bob", "Sally")
};

var friendsByPerson = people
    .GroupBy(p =>
        p.p1Name).ToDictionary(grp =>
            grp.Key, grp =>
                grp.Select(g =>
                    g.p2Name));


var friendsOfJoe = friendsByPerson["Joe"];

var friendsOfFriendsofJoe = friendsOfJoe
    .SelectMany(name1 =>
        friendsByPerson[name1].Where(name2 =>
            !friendsOfJoe.Contains(name2)));
If I were as smart as our local code witch, I might try to create a converter for C# <=> Cypher Smile | :)

If you care to share your experiences, or interest in graph db's, I am ready to eat your live coals of wisdom with สี่หูห้าตา "four eyes and five ears" [^]
«One day it will have to be officially admitted that what we have christened reality is an even greater illusion than the world of dreams.» Salvador Dali


modified 10-Feb-20 1:23am.

GeneralRe: having some fun looking into graph databases I Pin
honey the codewitch9-Feb-20 20:17
mvahoney the codewitch9-Feb-20 20:17 
GeneralRe: having some fun looking into graph databases I Pin
Jörgen Andersson9-Feb-20 21:28
professionalJörgen Andersson9-Feb-20 21:28 
JokeRe: having some fun looking into graph databases I Pin
lw@zi 9-Feb-20 20:35
professional lw@zi 9-Feb-20 20:35 
GeneralRe: having some fun looking into graph databases I Pin
BillWoodruff9-Feb-20 23:42
mveBillWoodruff9-Feb-20 23:42 
GeneralRe: having some fun looking into graph databases I Pin
phil.o9-Feb-20 22:55
mvephil.o9-Feb-20 22:55 
GeneralRe: having some fun looking into graph databases I Pin
BillWoodruff10-Feb-20 0:09
mveBillWoodruff10-Feb-20 0:09 
GeneralRe: having some fun looking into graph databases I Pin
phil.o10-Feb-20 0:13
mvephil.o10-Feb-20 0:13 
GeneralRe: having some fun looking into graph databases I Pin
F-ES Sitecore9-Feb-20 23:01
mveF-ES Sitecore9-Feb-20 23:01 
GeneralRe: having some fun looking into graph databases I Pin
Jon McKee10-Feb-20 6:29
professionalJon McKee10-Feb-20 6:29 
GeneralRe: having some fun looking into graph databases I Pin
BillWoodruff10-Feb-20 11:36
mveBillWoodruff10-Feb-20 11:36 
GeneralRe: having some fun looking into graph databases I Pin
Jon McKee10-Feb-20 13:25
professionalJon McKee10-Feb-20 13:25 
GeneralRe: having some fun looking into graph databases I Pin
BillWoodruff10-Feb-20 15:25
mveBillWoodruff10-Feb-20 15:25 
GeneralRe: having some fun looking into graph databases I Pin
Richard Deeming10-Feb-20 9:53
mveRichard Deeming10-Feb-20 9:53 
GeneralRe: having some fun looking into graph databases I Pin
BillWoodruff10-Feb-20 11:39
mveBillWoodruff10-Feb-20 11:39 
GeneralI think the game designers should bear some responsibility here as well... Pin
OriginalGriff9-Feb-20 8:30
mveOriginalGriff9-Feb-20 8:30 
GeneralRe: I think the game designers should bear some responsibility here as well... Pin
Jörgen Andersson9-Feb-20 8:44
professionalJörgen Andersson9-Feb-20 8:44 
GeneralRe: I think the game designers should bear some responsibility here as well... Pin
OriginalGriff9-Feb-20 9:00
mveOriginalGriff9-Feb-20 9:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.