Beispiel #1
0
        public async Task <Node> GetMinNodeDijkstra(int graphId)
        {
            BFSObject bfsObject = new BFSObject()
            {
                graphId = graphId
            };
            HttpResponseMessage response = await HttpClient.PostAsJsonAsync("GetMinNodeDijkstra/", bfsObject);

            return(response.IsSuccessStatusCode ? response.Content.ReadAsAsync <Node>().Result : null);
        }
Beispiel #2
0
        public async Task <double> GetMinimalPathWeightDijkstra(int id, string start, string end)
        {
            BFSObject bFSObject = new BFSObject()
            {
                graphId        = id,
                startNodeLabel = start,
                endNodeLabel   = end
            };
            HttpResponseMessage response = await HttpClient.PostAsJsonAsync("GetWeightBetweenNodesDijkstra/", bFSObject);

            return(response.IsSuccessStatusCode ? response.Content.ReadAsAsync <double>().Result : -1.0);
        }
Beispiel #3
0
        public IHttpActionResult GetMinNodeBFS(BFSObject bfsObject)
        {
            Graph graph = _graphService.GetGraph(bfsObject.graphId);

            if (graph != null)
            {
                return(Ok(_graphService.getMinNodeCoarseGrained(graph)));
            }
            else
            {
                return(NotFound());
            }
        }
Beispiel #4
0
        public IHttpActionResult GetMinNodeDijkstra(BFSObject bfsObject)
        {
            Graph graph = _graphService.GetGraph(bfsObject.graphId);

            if (graph == null)
            {
                return(NotFound());
            }
            else
            {
                Node node = _graphService.GetMinNodeDijkstra(graph);
                return(Ok(node));
            }
        }
Beispiel #5
0
        public IHttpActionResult GetWeightBetweenNodesDijkstra(BFSObject bfsObject)
        {
            Graph graph     = _graphService.GetGraph(bfsObject.graphId);
            Node  startNode = _graphService.findNodeByLabel(graph, bfsObject.startNodeLabel);
            Node  endNode   = _graphService.findNodeByLabel(graph, bfsObject.endNodeLabel);

            if (graph != null && startNode != null && endNode != null)
            {
                double weight = _graphService.GetWeightBetweenNodesDijkstra(graph, startNode, endNode);
                return(Ok(weight));
            }
            else
            {
                return(NotFound());
            }
        }
Beispiel #6
0
        public IHttpActionResult GetMinimalPathWeightBFS(BFSObject bFSObject)
        {
            Graph graph     = _graphService.GetGraph(bFSObject.graphId);
            Node  startNode = _graphService.findNodeByLabel(graph, bFSObject.startNodeLabel);
            Node  endNode   = _graphService.findNodeByLabel(graph, bFSObject.endNodeLabel);

            if (startNode != null && endNode != null)
            {
                int weight = BFSMethods.ShortestPathToGiven(graph, startNode, endNode);
                return(Ok(weight));
            }
            else
            {
                return(NotFound());
            }
        }