Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
16 views

Project On Weighted Programming Graph

Weighted programming
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

Project On Weighted Programming Graph

Weighted programming
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

NAMES AND MATRICULE:

->Njobe Loveline Nkeni ICTU20234424

->Penchia Noudja Liston Andreas ICTU20233759

->Ofon junior ICTU20233812

->Siyapze Lewis Bianda ICTU20234405

->Noumbissi Yamdjeuson Stanley Derek ICTU20233752

->Mike Juan Victor ICTU20233888

Project on weighted programming graph

Definition:

weighted programming graph is a graph where each edge has an


associated numerical value called a weight. These weights can
represent various factors such as cost, distance, time, capacity, or
any other metric that can be quantified.

Key Concepts of Weighted Programming Graphs

-Vertices (Nodes): These represent the entities or points in the


graph.

-Edges (Links): These are the connections between the vertices. In a


weighted graph, each edge has a weight.
-Weights: Numerical values associated with each edge that represent
some quantity, like distance or cost.

Common Representations

-> Adjacency Matrix: A 2D array where the element at (i, j)


represents the weight of the edge from vertex i to vertex j.
-> Adjacency List: A list where each element represents a
vertex and contains a list of tuples representing connected
vertices and edge weights.
-> Edge List: A list of all edges in the graph, where each
edge is represented by a tuple (start_vertex, end_vertex,
weight).

Project Goals

 1 Understand and implement weighted graphs.

-Dijkstra's Algorithm: Finds the shortest paths from a single


source vertex to all other vertices in a weighted graph.

Implementation Considerations:

 Memory Management: Proper allocation and deallocation of


memory for vertices, edges, and data structures.
 Error Handling: Handling invalid inputs, memory allocation
failures, and algorithm-specific error conditions.
 Efficiency: Choosing appropriate data structures and
algorithms to ensure efficient graph operations.

 2 Implement key algorithms for weighted graphs.

Implementing key algorithms for weighted graphs involves


understanding the theoretical foundations of these algorithms and
how they operate on graphs Here, I'll provide an overview of
Dijkstra's algorithm for finding the shortest path

Dijkstra's Algorithm

Description:

Dijkstra's algorithm finds the shortest path from a single source


vertex to all other vertices in a weighted graph. It works by
iteratively selecting the vertex with the smallest tentative
distance from the source and relaxing its adjacent vertices'
distances.

Algorithm:

1. Initialize the distance to all vertices as infinity, except


for the source vertex, which is set to 0.
2. Create a priority queue to store vertices ordered by their
tentative distance from the source.
3. Insert the source vertex into the priority queue with a
distance of 0.
4. While the priority queue is not empty:
Extract the vertex with the smallest tentative distance
from the priority queue.
For each adjacent vertex:
 Update its tentative distance if a shorter path is
found.
 Insert it into the priority queue if its distance
was updated.
5. Repeat step 4 until the priority queue is empty.

Time Complexity:

Dijkstra's algorithm has a time complexity of


(( + )log⁡ )O((V+E)logV), where V is the number of vertices
and E is the number of edges.

3 Apply these algorithms to solve real-world problems.


Dijkstra's algorithm is commonly applied to solve real-world
problems involving finding the shortest path in a weighted graph.
Here are two examples of how Dijkstra's algorithm can be used in
practical scenarios:

Example 1: Navigation System

Suppose you're developing a navigation system for a city with one-


way streets, and you want to find the shortest route from a starting
point to a destination while considering the travel time on each
street. You can model the city as a weighted graph, where vertices
represent intersections, edges represent streets, and edge weights
represent travel time. By applying Dijkstra's algorithm, you can
efficiently find the shortest path from the starting point to the
destination, taking into account the travel time on each street.

Example 2: Network Routing

In computer networking, routers use routing algorithms to determine


the best path for data packets to travel from the source to the
destination. Dijkstra's algorithm can be used in this context to
find the shortest path between two routers in a network, where edge
weights represent metrics such as latency or bandwidth. By applying
Dijkstra's algorithm, routers can efficiently determine the optimal
path for data packets to travel through the network, minimizing
latency and maximizing throughput.

 Visualize weighted graphs and their properties.

Visualizing weighted graphs and their properties is essential for


understanding the structure of the graph and the relationships
between vertices and edges. Here's how you can visualize a weighted
graph and its properties:

1 Graph Visualization Tools: Use graph visualization tools such as


NetworkX (Python), Graphviz, or Gephi to visualize weighted graphs.
These tools allow you to create visual representations of graphs,
customize the appearance of vertices and edges, and analyze the
properties of the graph.

2 Node and Edge Attributes: Assign attributes to nodes and edges


based on their properties, such as vertex coordinates, edge weights,
or edge types. These attributes can be used to customize the
appearance of nodes and edges in the graph visualization.

3 Graph Properties: Analyze properties of the graph, such as


connectivity, centrality measures, and shortest paths. Visualize
these properties using graph visualization tools to gain insights
into the structure and behavior of the graph.

4 Interactive Visualization: Create interactive visualizations of


weighted graphs that allow users to explore the graph, zoom in/out,
and interact with nodes and edges. Interactive visualizations can
provide a more immersive and engaging experience for users to
explore the graph and its properties.

ADVANTAGES AND DISADVANTAGES OF WEIGHTED GRAPH

Advantages:

-Optimization: Weighted programming graph enables more efficient


resource allocation, reducing costs and improving performance.

-Flexibility: Weighted programming graph allows for greater


flexibility in network design, allowing for adjustments as
conditions change.
Disadvantages:

Complexity: Weighted programming graph problems can be


computationally complex, requiring significant computing
resources to solve.

Conclusion:

By understanding and implementing these aspects of weighted


programming graphs, you can effectively model and solve various
real-world problems involving optimization and network analysis.
Additionally, visualization aids in better understanding and
analyzing graph structures and properties, leading to informed
decision-making in practical scenarios.

You might also like