Skip to content

Instantly share code, notes, and snippets.

@nsengupta
Created July 17, 2015 17:36
Show Gist options
  • Save nsengupta/87d29a1553dcaeb8bd4e to your computer and use it in GitHub Desktop.
Save nsengupta/87d29a1553dcaeb8bd4e to your computer and use it in GitHub Desktop.
Example of adding Node-Edge-Node triples to a graph
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