Computer Notes, Programming codes, Hardware and Networking Tip, Entertainment, Biography, Internet Tip, Tech News, Latest Technology, YouTube,

Latest Post
About RAM Advantages of multiprocessing system Associative memory Binary Number System CA CA Notes Change drive icon change pendrive icon Computer Abbreviation Computer Architecture Computer fundamental MCQ Computer Generation Computer generation computer notes Computer MCQ Computer Network MCQ Computer Operator MCQ Critical Section Critical section in OS Database connectivity in java Deadlock avoidance Deadlock detection algorithm Deadlock Detection and Recovery Deadlock detection method Deadlock Handling Deadlock in OS Deadlock Prevention Deadlock Recovery define object and class Define system cell Descrete Structure Device Driver Device driver in computer device driver in os DFA DFA contains with DFA ends with dfa examples dijkstra's algorithm Discrete Structure Discrete Structure graph theory Download JDBC Driver Download MySql Download PUBG DS DS Notes FCFS Job Scheduling Algorithm Finding shortest path Finite Sate Automata Flynn's Classifications fragmentation in computer fragmentation in harddisk fragmentation in os fragmented memory Full form related to computer Generations of operations Generations of OS Graph theory ICT 1st semester notes Instruction Address Modes Java java array declaration java class and object example Java Database connectivity example java event handling example program Java JDBC Java JMenuBar Java JSP program example java notes java program methods example Java program to create class and object java program to create methods java program to print even number between any two numbers Java programming java programming notes Java programs Java question answer java swing example java swing program to calculate simple interest Java Tutorials JSP program learn qbasic Lekh MCQ MCQ Computer MCQ Operating System memory fragmentation MICT 1st semester notes mict 1st semester operating system notes MICT first semester notes Multiprocessing mutex in os Necessary conditions for deadlock Number System Operating System Operating system notes OS OS Notes OS Numeric pattern printing program in qbasic patterns in qbasic Pipeline Hazards Pipelining Pipelining concept prime or composite in qbasic print patterns qbasic print series in qbasic Printing Series in qbasic PUBG PUBG Mobile PUBG PC PUBG Story qbasic qbasic code qbasic for class 10 qbasic for class 8 qbasic for class 9 qbasic for school QBASIC Pattern printing qbasic pattern printing program qbasic pattern printing programs qbasic pattern types qbasic patterns qbasic programming tutorials qbasic programs qbasic sequence printing programs qbasic tutorials Race Condition in Operating system reverse order in qbasic RISC and CISC RISC Pipeline Scheduling algorithm segmentation in operating system segmentation in os semaphore and mutex Semaphore concept in os Semaphore in os semaphore in os notes semaphore meaning sequential programs in qbasic series in qbasic series printing programs in qbasic shell in operating system shell in os shortest path shortest path algorithm simple interest program in java swing System Bus System Cell Teach Blog Tech Blog Tech School technical school The Shell in Operating system types of fragmentation Types of Multiprocessor types of operating system Types of pipeline hazards View Connected Wifi password Virtual Memory Virtual memory in OS Von Neumann's architecture What is associative memory? what is class? What is computer system? What is Fragmentation? What is jsp? what is object? What is process? What is segmentation What is System Cell What is Thread? what is virtual memory in computer What is virtual memory? पब्जी गेम

Graph Theory |Walk, Path, Trial, Cycle and Circuit in Graph|



Walk

Let G=(V, E) a Graph, then 
A walk in G is a list W={u, e1, v1, e2, v2 ...... v} whose elements are alternatively vertices and degrees. 
The vertices u and v are called its end-vertices. 
The vertices v1, ........ are called inner vertices. 
In a simple graph, walk can be denoted by sequence of vertices only. 

Path

Let G=(V, E) be a Graph, then 
A path in G is a walk with no repeated vertex and edges. 

Trial 

Let G=(V, E) be a Graph, then 
A trial in G is a walk with no repeated edges. 

Cycle

Let G=(V, E) be a Graph, then 
A cycle in G is a closed path. 
In a cycle, start and end vertex are same. 

Circuit

Let G=(V, E) be a graph, then 
A trial in G is a walk with no repeated edges. Now a closed trial in G is closed circuit. 



Example: In the graph given below, construct walk, path, trial, cycle and circuit from a to e. 

           A)   
Graph
Solution Here, 
1. Walk (Vertex and Edge can be repeated) 
walk = {a, b, f, a, b, e}

2. Path (Vertex and Edge is not repeated) 
path = {a, b, f, e}

3. Trial (Vertex can be repeated, Edges not repeated) 
trial = {a, b, f, g, a, f, e}



4. Cycle (Vertex not repeated, Edge not repeated, close path)
cycle = {a, b, e, f, a}

5. Circuit (Vertex can be repeated, edge not repeated, close trial)
circuit = {a, f, b, e, f, g, a}



Dijkstra's algorithm is used to find the shortest path between source vertex (a) to destination vertex (b).


According to Dijkstra's algorithm, to find the shortest path from source vertex to destination vertex we need to follow the following steps.
Step 1: Remove all the loops
Step 2: Remove all parallel edges between two vertices except the one with least weight.
Step 3: Create the weight matrix table
            i) Set 0 to the source vertex and infinite to the remaining vertices.
                        For all vertices, repeat (ii) and (iii)
            ii) Mark the smallest unmarked value and mark that vertex.
            iii) Find those vertices which are directly connected with marked vertex and update all.
                  Update value formula:
                  New Destination value = Minimum(Old destination value, Marked value + Edge weight)
Step 4: Perform backtrack
Some Examples: 

1. Find shortest path from a to g. 



2. Find shortest path from a to c. 


QBASIC Program to print the given string in reverse order

CLS
INPUT "Enter any String "; s$
FOR i = LEN(s$) TO 1 STEP -1
    r$ = MID$(s$, i, 1)
    b$ = b$ + r$
NEXT i
PRINT "Reverse Order = "; b$
END

Using SUB .... END SUB

DECLARE SUB revf(s$)
CLS
INPUT "Enter any String "; s$
CALL rev(s$)
END

SUB rev (s$)
    FOR i = LEN(s$) TO 1 STEP -1
        r$ = MID$(s$, i, 1)
        b$ = b$ + r$
    NEXT i
    PRINT "Reverse Order = "; b$
END SUB



Using FUNCTION ... END FUNCTION

DECLARE FUNCTION rev$(s$)
CLS
INPUT "Enter any string "; s$
re$ = rev$(s$)
PRINT "Reverse Order = "; re$
END

FUNCTION rev$ (s$)
    FOR i = LEN(s$) TO 1 STEP -1
        r$ = MID$(s$, i, 1)
        b$ = b$ + r$
    NEXT i
    rev$ = b$
END FUNCTION


Video Tutorial in Nepali Language

MKRdezign

Contact Form

Name

Email *

Message *

Powered by Blogger.
Javascript DisablePlease Enable Javascript To See All Widget