S
S
Stanislav Ivanov2020-11-15 23:40:31
C++ / C#
Stanislav Ivanov, 2020-11-15 23:40:31

How to create a graph from a quadratic matrix?

In general, I need to create a graph using a quadratic matrix consisting of 0 and 1. Unfortunately, I'm not too versed in this topic, and I don't have time to start figuring it out. Can you tell me how to implement it in C# or give an algorithm by which this functionality could be implemented?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Zagaevsky, 2020-11-16
@zagayevskiy

Not square, but square. The vertices of the graph are numbered from 0 to n-1. An n*n matrix M is created. If vertices i and j are connected by an edge, then M[i, j] = 1, otherwise 0. If the graph is undirected, then the matrix will be symmetric with respect to the main diagonal. If directed, then no.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question