|
Jon McKee wrote: Don't forget about relationship direction Hi, Jon,
"Directionality" is an issue I raise explicitly in my post: don't forget that
Neo4j edges/vertices/connections are one-way. I see nothing in the Cypher query that suggests "Your Cypher query is bi-directional:" it's just a compound/chained query.
cheers, Bill
«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
|
|
|
|
|
What I was alluding to was that no direction for the relationship is specified in your Cypher query. This means that outgoing and incoming relationships will be searched in the match. So for example:
CREATE (p1:Person)-[:KNOWS]->(p2:Person)
//Matches both p1 and p2
MATCH (p:Person)-[:KNOWS]-(:Person)
RETURN p
//Matches only p1
MATCH (p:Person)-[:KNOWS]->(:Person)
RETURN p
Un-directed was probably a better word to use than bi-directional. My bad. Since it's common to think of directed relationships as p2 "not knowing about" p1 since you can't traverse to p1 directly from p2, I figured I'd point out this little nuance of matching in case you weren't aware. The LINQ example would only match p1 so I thought maybe there was some misunderstanding.
|
|
|
|
|
Thanks Jon, for the clarification: I still can't see any differences between my translation of the Cypher into C# ... both are really two queries; I didn't chain the C# queries because I wanted to make the code more explicit for display here.
I think I see your point about bi-directional: the second query is looking for connections to Joe.
My apologies for being dense
cheers, Bill
«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
|
|
|
|
|
If you start with Jim, your C# will throw an exception.
You could try:
var friendsOfFriendsofJoe = friendsOfJoe
.SelectMany(name => friendsByPerson.TryGetValue(name, out var myFriends) ? myFriends : Enumerable.Empty<string>())
.Except(friendsOfJoe)
.Where(name => name != "Joe"); Or you could go for the (only slightly brain-melting) functional option:
static class GraphExtensions
{
public static IReadOnlyDictionary<string, IEnumerable<string>> FriendsByPerson(this IEnumerable<(string n1, string n2)> source)
{
return source.GroupBy(p => p.n1).ToDictionary(g => g.Key, g => g.Select(p => p.n2));
}
public static Func<string, IEnumerable<string>> FriendsOfFriends(this IReadOnlyDictionary<string, IEnumerable<string>> friendsByPerson)
{
return name =>
{
if (!friendsByPerson.TryGetValue(name, out var friends))
{
return Enumerable.Empty<string>();
}
return friends
.SelectMany(f => friendsByPerson.TryGetValue(f, out var foaf) ? foaf : Enumerable.Empty<string>())
.Except(friends)
.Where(f => f != name);
};
}
}
...
Func<string, IEnumerable<string>> foafByPerson = people.FriendsByPerson().FriendsOfFriends();
foreach (string foaf in foafByPerson("Anna"))
{
Console.WriteLine(foaf);
} Obviously this assumes the connections are one-way - Jim knows Mike, but Mike doesn't know Jim. If Cypher / Neo4J assumes bi-directional connections, the code would get slightly more complicated:
public static IReadOnlyDictionary<string, IEnumerable<string>> FriendsByPerson(this IEnumerable<(string n1, string n2)> source)
{
return source
.Concat(source.Select(p => (n1: p.n2, n2: p.n1)))
.GroupBy(p => p.n1)
.ToDictionary(group => group.Key, group => group.Select(p => p.n2));
}
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Wow ! Thanks ... I will, as ever, study your keen insights and code
I really like functions that return functions !
cheers, Bill
«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
|
|
|
|
|
|
Quote: think the game designers should bear some responsibility here as well...
Not disagreeing, but...
Quote: Katie Phillips' daughter reset security settings to accept her own fingerprint to make purchases I believe some one else has more responsibility.
Assuming this simply isn't just the parents bullshitting.
|
|
|
|
|
Don't get me wrong - the daughter is the primary culprit, and her mother deserves blame as well.
But Roblox is designed for kids, and it's at best unethical to allow them to do that. If gambling is "restricted" with gambling companies required to warn people if they are spending too much too quickly (and they are in the UK at least though it's as useful as a chocolate teapot) then allowing kids to generate that kind of debt is a disgusting practice IMO.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I was actually referring to a certain fruit company in this case.
Having so bad security that the daughter could change the fingerprint for appstore is remarkable, imao.
On that other system I have Family link installed. Any time my kids try to install something that costs money, I have to ok it. On my own phone.
I also get the possibility to limit the time spent on these gadgets, and I can easily block apps I don't agree with. On distance.
The kids learn quickly and don't click anything that's an In app purchase.
|
|
|
|
|
You don't mean ... iPurchases iGive iPercentage iTo iCompany iSo iThey iDon't iCare ... iSurely iNot!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
OriginalGriff wrote: You don't mean ...
Actually...
|
|
|
|
|
But ...
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Jörgen Andersson wrote: Having so bad security that the daughter could change the fingerprint for appstore is remarkable, imao. I didn't think it was possible. Any changes to verification methods/details require entry of the password.
There may be more to this than Mum is telling.
I wanna be a eunuchs developer! Pass me a bread knife!
|
|
|
|
|
There certainly can be. That's why I added the sentence about the mother bullshitting in my first answer.
I'm going to test it on my wifes fruitphone tonight.
|
|
|
|
|
Checked it during lunch on a coworkers phone.
If you setup your phone to use TouchID you need to enter your passcode to add fingerprints on your phone.
You can then allow TouchID to authorize Appstore. For that you need to authenticate once using your AppleID.
If you later decide to add another fingerprint to the TouchID service you only need to authenticate yourself using your Passcode. You don't need to authenticate yourself using your AppleID.
|
|
|
|
|
So the girl could have done it.
I'd call that a poorly-thought-out security process, and can't help but wonder how many other children have managed to buy stuff without their parents knowing.
I wanna be a eunuchs developer! Pass me a bread knife!
|
|
|
|
|
Having seen the way my 3-year old grandson plays with any family member's mobile phone, and in the past my granddaughter on some Disney online game, I totally agree. Children have no idea what's going on in these devices, or the costs associated with them.
|
|
|
|
|
"255" ... almost sounds like bot work.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
Forgive me in advance for being a ludite.
Quote: after her eight-year-old daughter
Eight year old's should not have an iPad, iPhone, etc etc etc. In my ludite strong opinion, anyone under 13 shouldn't.
They should be out playing, or reading, or doing something that properly develops their minds and souls. For those of you old enough, I'm sure you can remember occupying yourself with all sorts of fun things that didn't involve staring mindlessly at a screen and clicking on things with your thumbs.
The fault here lies in the broader scope of our society in general and the bullshit that we call social media, entertainment, and so forth, that we have been led to believe is good for our children and has some actual value as an adult.
And don't give me this bullshit that they need a head start in today's world. I didn't touch a computer until 7th grade, and it was a teletype machine that saved programs to tape - punch tape!!!
|
|
|
|
|
I am from the generation who went outside to play.
Hated it!
Luckily I had my own NES back then, and a little later I got my own PC with games such as Age of Empires and The Curse of Monkey Island
I had friends who had limited computer time, like an hour or two a day, I never understood why.
I have a cousin who is the same, but his sister still likes to go outside.
Maybe the "problem" is that not everyone likes to go outside and do stupid stuff like run after a ball and be social
|
|
|
|
|
While I agree with your overall sentiment that nobody under 13 should have an iDevice, need I remind anyone that the previous generation was also accused of using television as a babysitter. Or a substitute for actual parenting.
I totally agree also with the idea that they "should be out playing". George Carlin had a whole bit about going out and playing with a stick.
But no, today, everybody still outside is a child kidnapper, a murderer or a Catholic priest.
|
|
|
|
|
I understand where that comes from, and while I agree in principle, reality looks different today.
My son was the second last one to get a phone in his class, and he was always sitting at home doing nothing productive. And when asked why, it was always because he didn't know what the others were up to.
Strange answer! Right?
I finally realized that he was outside the loop.
He has a phone now, often out playing. Kids nowadays communicate using messages.
|
|
|
|
|
I would suspect the parents did not set up a fingerprint authorisation and the kid only had to set a new finger print rather than change an existing one - it is still a flaw in the apple system and unconscionable actions by the app designer to accept such volume from a rugrat.
Never underestimate the power of human stupidity -
RAH
I'm old. I know stuff - JSOP
|
|
|
|
|
Mycroft Holmes wrote: I would suspect the parents did not set up a fingerprint authorisation Either that or it was a fun game, showing the girl how to use her thumb with the device.
Should be fun paying the bill, too. I don't think the digit I'd give apple would be a thumb.
I wanna be a eunuchs developer! Pass me a bread knife!
|
|
|
|
|
Quote: Ms Phillips, 35, said: "I felt sick and was in floods of tears. ... It was hard to be too angry with her because she didn't really know what she was doing and she didn't understand. An eight-year old who can bypass security and install her fingerprint as a new password didn't know what she was doing ?
Well, this is what happens when parents with pointy chins give an eight-year old an £300 iPad.
I fault the parents, and I fault Barclay's for not flagging such a suspicious series of purchases in a short time and notifying the parents,.
To the young lady: I think you have a very bright future, and I suspect MI6 is going to recruit you.
«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
|
|
|
|