-
Notifications
You must be signed in to change notification settings - Fork 336
If 'yes,' it would be useful to see a simple example.
thanks, Bill
All reactions
Replies: 3 comments 2 replies
billwoo Absolutely! I use it heavily in our Graph Engine Power Microservices hosted via Azure VM Scale Sets. I'll need to mock up some code as an example. I'll post it under the Show and Tell portion of the Repo; I'll create a link and post it here when I've got It done.
All reactions
I've not forgotten about this request - I've been busy trying to get a new beta release out. I'll try to get around to this next week.
All reactions
Thanks ! I did not see your June 29th. reply until now.
As you have time, I look forward to hearing more.
cheers, Bill
All reactions
billwoo here is an example of how you can use the LIKQ in C# on the Graph Engine App server side:
using System.Collections.Generic;
using Trinity;
using Trinity.Storage.CompositeExtension;
using Trinity.LIKQ;
public class GraphTraversal
{
public static List<CellId> Custom_FanoutSearch(CellId startNode)
{
List<CellId> result = new List<CellId>();
var paths = KnowledgeGraph.
.FollowEdge("isa_agent")
.FollowEdge("isa_buyer_lead")
.VisitNode(node => node.GetField<string>("rdf_subject").Contains("business_process") == node.Has("workflow"),
select: new List<string> { "open_house", "new_client" })
.VisitNode(queryPart => queryPart.ContinueIf(queryPart.HasCellId(0)))
.ToList();
result.AddRange(paths);
return result;
}
}
All reactions
Here is an example of how you can implement BFS using LIKQ Fanoutsearch:
using System.Collections.Generic;
using Trinity;
using Trinity.Storage.CompositeExtension;
using Trinity.LIKQ;
public class GraphTraversal
{
public static List<CellId> BFS_Traversal(CellId startNode)
{
List<CellId> visitedNodes = new List<CellId>();
Queue<CellId> queue = new Queue<CellId>();
visitedNodes.Add(startNode);
queue.Enqueue(startNode);
while (queue.Count > 0)
{
CellId currentNode = queue.Dequeue();
var neighbors = KnowledgeGraph
.StartFrom(currentNode)
.FollowEdge("next")
.ToList();
foreach (CellId neighbor in neighbors)
{
if (!visitedNodes.Contains(neighbor))
{
visitedNodes.Add(neighbor);
queue.Enqueue(neighbor);
}
}
}
return visitedNodes;
}
}