Skip to content

Navigation Menu

Sign in
Sign up

can GraphEngine and LIKO be used in a C# app ? #352

billwoo started this conversation in General
Discussion options

If 'yes,' it would be useful to see a simple example.

thanks, Bill

You must be logged in to vote

Replies: 3 comments 2 replies

Comment options

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.

You must be logged in to vote
2 replies
Comment options

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.

Comment options

Thanks ! I did not see your June 29th. reply until now.

As you have time, I look forward to hearing more.

cheers, Bill

Comment options

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;
 }
}
You must be logged in to vote
0 replies
Comment options

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;
 }
}
You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /