Questions tagged [adjacency-matrix]

A means of representing which vertices (or nodes) of a graph are adjacent to which other vertices.

The adjacency matrix of a finite graph G on n vertices is the n×n matrix where the non-diagonal entry aij is the number of edges from vertex i to vertex j, and the diagonal entry aii, depending on the convention, is either once or twice the number of edges (loops) from vertex i to itself.

Undirected graphs often use the latter convention of counting loops twice, whereas directed graphs typically use the former convention.
There exists a unique adjacency matrix for each isomorphism class of graphs (up to permuting rows and columns), and it is not the adjacency matrix of any other isomorphism class of graphs.
In the special case of a finite simple graph, the adjacency matrix is a (0,1)-matrix with zeros on its diagonal.

If the graph is undirected, the adjacency matrix is symmetric.

The relationship between a graph and the eigenvalues and eigenvectors of its adjacency matrix is studied in spectral graph theory.

http://en.wikipedia.org/wiki/Adjacency_matrix

900 questions
-2
votes
2 answers

convert a simple matrix to incidence matrix with python

i want to make graph network from incidence Matrix, but i don't have an incidence Matrix, i have just a simple Matrix.so my question is: how to convert a simple Matrix to a incidence Matrix to draw a graph network with python?
-2
votes
1 answer

How can i create a directed adjacency matrix based on some conditions from my data frame in R?

I have a dataset of albums from 60s to 2010s and my goal is a network to visualize the influences beteen albums over the years. I want to create an adjacency matrix based on two variables conditions: genre and release date. Genre is character and my…
-2
votes
1 answer

Matrix formalism NxN adjacency matrix

Let A be the NxN adjacency matrix of an undirected unweighted network, without self-loops. Let 1 be a column vector of N elements, all equal to 1. In other words 1 = (1, 1, ..., 1)T , where the superscript T indicates the transpose operation. Use…
-2
votes
1 answer

How to import an adjacency array from a file in .txt format with edge notation (v, w)?

How to import an adjacency array from a file in .txt format with edge notation (v, w) in RStudio? The contents of the .txt file are as follows: 5vertices,não dirigido 0,1 1,2 1,3 2,3 3,4 4,0 Reinforcement that this is the notation of vertices in the…
Tiago
  • 11
  • 1
-2
votes
2 answers

How to convert an adjacency matrix to an adjacency list with python?

I have an adjacency matrix like: [[ 0., 15., 0., 7., 10., 0.], [ 15., 0., 9., 11., 0., 9.], [ 0., 9., 0., 0., 12., 7.], [ 7., 11., 0., 0., 8., 14.], [ 10., 0., 12., 8., 0., 8.], [ …
-2
votes
1 answer

adjacency matrix from text file c code

For a project, I need to take an adjacency matrix as input in a C program from a text file. The text file contains the edge details of the graph for which the matrix is to be constructed. The format of the text file is given below. 5 4 3 …
amun101
  • 1
  • 1
  • 1
-2
votes
1 answer

Can you help me figuring out, what this Snipped of Java-code is supposed to do?

I found this Java code in a job interview question and tried to figure it out. (I am a Smalltalker and am less familar with the syntax of Java as maybe I thought). As far as I can see, it spawns a thread for every row in a data matrix. The thread…
AME
  • 2,499
  • 5
  • 29
  • 45
-2
votes
1 answer

Calculating adjacency matrix from randomly generated graphs

I have developed small program, which randomly generates several connections between the graphs (the value of the count could be randomly too, but for the test aim I have defined const value, it could be redefined in random value in any time). Code…
Secret
  • 2,627
  • 7
  • 32
  • 46
-3
votes
1 answer

random number from 0-100 opposite numbers in the upper triangle and the one tringle in symmetrical matrix

I made the NxN matrix with Zeros and Ones and symmetrical and diagonal = 0. Now I want to make another matrix. Instead of the one in the matrix, I put a random number from 0-100 opposite numbers in the upper triangle and the one tringle have the…
-3
votes
1 answer

Implementing an Adjacency Matrix in Java

I have been tasked to create a class 'GraphOfCity' that runs off and accounts for methods from a driver code included below. Each time I make progress on GraphOfCity I end up doing something wrong and end up back to square one. I have created a…
CS_J
  • 1
  • 2
-3
votes
2 answers

finding top n weighted edge from an adjacency matrix

I'm so confused by graphs and adjacency matrix.I have a graph with large numbers of nodes and edges (for example 5000 vertexes and 6000 edges ).I have to give score (with jaccard algorithm) to each pair-nodes that aren't adjacent.I work with gephi…
sam
  • 7
  • 2
-3
votes
1 answer

"too many arguments for format" warning

#include #define N 11 enum {FALSE, TRUE}; typedef int adj_mat[N][N]; int path2(adj_mat A, int u, int v, int temp) { if(u == temp && A[u][v] == TRUE) return TRUE; if(A[u][v] == FALSE) return path2(A, u-1, v, temp); if(A[u][v] ==…
user4831626
  • 9
  • 1
  • 1
  • 6
-4
votes
1 answer

I am trying to understand a code on adjacency matrix written in Java language ,I am not able to understand the enhanced for loop part

// Add edges public void addEdge(int i, int j) { adjMatrix[i][j] = true; adjMatrix[j][i] = true; } // Remove edges public void removeEdge(int i, int j) { adjMatrix[i][j] = false; adjMatrix[j][i] = false; } // Print the…
-4
votes
3 answers

How to zero specific column of 2d array

Lets say I have a specific 2d array of 100x100 like so I'm implementing an adjacency matrix and thus I want to be able to zero a specific column and line (the same column and line in this case), zeroing lines is pretty straightforward but I'm not…
spacing
  • 730
  • 2
  • 10
  • 41
-5
votes
1 answer

algorithm for finding the number of 1s in a matrix (only vertical 1s). The image is self explanatory that what i exactly want

Algorithm is required for Finding the group of 1s in a matrix, but the group of 1s should contain only vertical entry
1 2 3
59
60