Click here to Skip to main content
15,900,815 members
Home / Discussions / C#
   

C#

 
QuestionCrystal report - urgent Pin
muharrem12-Nov-08 2:24
muharrem12-Nov-08 2:24 
AnswerRe: Crystal report - urgent Pin
Paul Conrad12-Nov-08 3:39
professionalPaul Conrad12-Nov-08 3:39 
Questioninsert in a stored procedure Pin
swjam12-Nov-08 1:46
swjam12-Nov-08 1:46 
AnswerRe: insert in a stored procedure Pin
Ashfield12-Nov-08 2:13
Ashfield12-Nov-08 2:13 
AnswerRe: insert in a stored procedure Pin
Simon P Stevens12-Nov-08 3:07
Simon P Stevens12-Nov-08 3:07 
AnswerRe: what do i put in the primary key value in my insert clause? Pin
swjam12-Nov-08 4:07
swjam12-Nov-08 4:07 
GeneralRe: what do i put in the primary key value in my insert clause? Pin
J4amieC12-Nov-08 4:58
J4amieC12-Nov-08 4:58 
QuestionDijkstra shortest path Help Pin
dudz198712-Nov-08 1:31
dudz198712-Nov-08 1:31 
Hi, im having some real PROBLEMS implementing this algorithm, i just cant find anywhere that explains it in a simple enough manner for me to understand, so i was wondering if anyone here could knock together a quick example for me? I've had a stab at it so far and this is what i've got:

public Hashtable FindShortestPath(string start, string end)
        {
            Dictionary<string, Node<T>> Q = new Dictionary<string, Node<T>>();
            Hashtable distance = new Hashtable();
            Hashtable route = new Hashtable();



            foreach (KeyValuePair<string, Node<T>> kvp in Nodes)
            {
                distance.Add(kvp.Key, Int32.MaxValue);
                route.Add(kvp.Key, null);
                Q.Add(kvp.Key, kvp.Value);
            }
      
            distance[start] = 0;

            while (Q.Count >= 0)
            {
                string minimumID = null;
                int minvalue = Int32.MaxValue;

                foreach (KeyValuePair<string, Node<T>> kvp in Q)
                {
                    if ((int)distance[kvp.Key] < minvalue)
                    {
                        minvalue = (int)distance[kvp.Key];
                        minimumID = kvp.Key;
                    }
                }

                foreach (Edge<T> e in EdgeList)
                {
                    if (e.startNode.ID == minimumID)
                    {
                        int startNodeDistance = (int)distance[minimumID];
                        int endNodeDistance = (int)distance[e.endNode.ID];

                        if (startNodeDistance + e.weight < endNodeDistance)
                        {
                            distance[e.endNode.ID] = startNodeDistance + e.weight;
                            route[e.endNode.ID] = minimumID;                          
                        }
                         
                    }
                    
                }
                 Q.Remove(minimumID);                                                                                                                                    
            }

            foreach(int k in route.Keys)
            {
                Console.WriteLine("k: " + route[k]);
            }

            return route;


Can someone tell me where im going wrong please?

Many Thanks
AnswerRe: Dijkstra shortest path Help Pin
Simon P Stevens12-Nov-08 2:59
Simon P Stevens12-Nov-08 2:59 
Questionaccess store procedure Pin
George_George12-Nov-08 1:30
George_George12-Nov-08 1:30 
AnswerRe: access store procedure Pin
Simon P Stevens12-Nov-08 2:57
Simon P Stevens12-Nov-08 2:57 
GeneralRe: access store procedure Pin
George_George12-Nov-08 21:32
George_George12-Nov-08 21:32 
GeneralRe: access store procedure Pin
Simon P Stevens12-Nov-08 21:43
Simon P Stevens12-Nov-08 21:43 
GeneralRe: access store procedure Pin
George_George13-Nov-08 0:01
George_George13-Nov-08 0:01 
GeneralRe: access store procedure Pin
Simon P Stevens13-Nov-08 0:59
Simon P Stevens13-Nov-08 0:59 
GeneralRe: access store procedure Pin
George_George14-Nov-08 1:21
George_George14-Nov-08 1:21 
Questionhow to use the toolbar button tag property during a toolbar click event Pin
swjam12-Nov-08 1:30
swjam12-Nov-08 1:30 
AnswerRe: how to use the toolbar button tag property during a toolbar click event Pin
V.12-Nov-08 1:55
professionalV.12-Nov-08 1:55 
QuestionC# exception definition Pin
George_George12-Nov-08 0:34
George_George12-Nov-08 0:34 
AnswerRe: C# exception definition Pin
Ravi Bhavnani12-Nov-08 1:03
professionalRavi Bhavnani12-Nov-08 1:03 
GeneralRe: C# exception definition Pin
George_George12-Nov-08 1:25
George_George12-Nov-08 1:25 
GeneralRe: C# exception definition Pin
Ravi Bhavnani12-Nov-08 7:27
professionalRavi Bhavnani12-Nov-08 7:27 
GeneralRe: C# exception definition Pin
George_George12-Nov-08 20:55
George_George12-Nov-08 20:55 
AnswerRe: C# exception definition Pin
Simon P Stevens12-Nov-08 2:01
Simon P Stevens12-Nov-08 2:01 
GeneralRe: C# exception definition Pin
George_George12-Nov-08 17:54
George_George12-Nov-08 17:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.