Computer Science, asked by rishimenon5116, 11 months ago

How are graphs represented inside a computer's. Memory? Which method do you prefer and why?

Answers

Answered by pragnyasarees39
8

Answer:

Graph is a data structure that consists of following two components:

1. A finite set of vertices also called as nodes.

2. A finite set of ordered pair of the form (u, v) called as edge. The pair is ordered because (u, v) is not same as (v, u) in case of a directed graph(di-graph). The pair of the form (u, v) indicates that there is an edge from vertex u to vertex v. The edges may contain weight/value/cost.

Graphs are used to represent many real-life applications: Graphs are used to represent networks. The networks may include paths in a city or telephone network or circuit network. Graphs are also used in social networks like linkedIn, Facebook. For example, in Facebook, each person is represented with a vertex

Answered by abigaildsouza510
1

Answer:

In computer science, graphs are used to represent networks of communication, data organization, computational devices, the flow of computation, etc.

Explanation:

In graph theory, a graph representation is a technique to store graph into the memory of computer. To represent a graph, we just need the set of vertices, and for each vertex the neighbors of the vertex (vertices which is directly connected to it by an edge).

There are three ways to store a graph in memory:

Nodes as objects and edges as pointers

A matrix containing all edge weights between numbered node x and node y

A list of edges between numbered nodes

Similar questions