Created
July 17, 2015 17:36
-
-
Save nsengupta/87d29a1553dcaeb8bd4e to your computer and use it in GitHub Desktop.
Example of adding Node-Edge-Node triples to a graph
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def assignPlayersToTable(pairs: List[(Player,GameTable)]) = { | |
| lobby = lobby ++ | |
| pairs.foldLeft(IndexedSeq[LDiEdge[LobbyNode]]())((holder,nextPair) => { | |
| (holder :+ rootToPlayer :+ playerToRoot) ++ giveSeatToPlayer(nextPair._1,nextPair._2) | |
| }).toList | |
| } | |
| def giveSeatToPlayer(p: Player, t: GameTable) = { | |
| IndexedSeq[LDiEdge[LobbyNode]]( | |
| setRelationWithLabel(p,t,"IsPlayingAt"), | |
| setRelationWithLabel(t,p,"seatOccupiedBy") | |
| ) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment