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
-1
votes
2 answers

access list from a list - python

I want to make an adjacency matrix A given biadjacency matrix B. The type is adjacency matrix in python. Let the matrix B = np.array([[1,2,3],[10,20,30],[3,4,5],[50,12,36],[5,6,7],[3,4,5]]) and its transpose Bt = np.transpose(B). Let, also, two zero…
Angelika
  • 37
  • 6
-1
votes
2 answers

Creating adjacency matrix for BFS

I am given a input file that contains numbers like this: 3 (searching for value 3 in graph) 5 (number of vertices in graph) 0 0 (vertex 0 has value has value 0) 2 (add 2 edges from vertex 0) 1 ( add an edge from vertex 0 to vertex 1) 2 ( add an…
S. James
  • 77
  • 5
-1
votes
1 answer

Creating Adjacency Matrix and Social Network Graph

I have to build a directed graph of a social network based on interactions with a business. My starting element is a two column table [user_id, [Friends]]. The entries for user_id come from subsetting a larger set on the basis of interaction with a…
home_wrecker
  • 365
  • 2
  • 11
-1
votes
1 answer

Plotting connections between spatial points based on adjacency matrix and coordinates list in R

I have a square matrix in which each elements contains the amount of connexions between the points associated with the corresponding row and column. I also have a list of coordinates for each of those points. My purpose is to plot this matrix such…
user3584444
  • 457
  • 1
  • 7
  • 12
-1
votes
1 answer

Make sure nested loop variables have different values

I want to create an adjacency matrix from another metric matrix in Matlab. My program is as follow: function [V] = adjacency(Z) n= size(Z,1); V = zeros(n); k=1:n; for i = 1:n for j = 1:n if Z(i,j)<= max(Z(i,k),Z(j,k)) …
fatima
  • 29
  • 4
-1
votes
3 answers

How to create Adjacency Matrix for dataset in Matlab?

i am a new user of matlab and need help in creating adjacency matrix from a data set. dataset is in the following pattern A=[ 0 1 0 2 0 5 1 2 1 3 1 4 2 3 2 5 3 1 3 4 3 5 4 0 4 2 5 2 5 4 …
Usman Raza
  • 13
  • 1
  • 3
-1
votes
2 answers

difference between list and array(np)?

I was trying add ones to some specific position in a 100*100 zero matrix. My code was something this: adjacency=[[0]*100]*100 while ... x=... y=... adjacency[x][y]=adjacency[x][y]+1 But it adds to other positions as well. In face,…
-1
votes
1 answer

Adjacency Matrix for User in R

I have a data as follows - user_id post_id 24376261 204506440 98461 204446324 98461 203026202 98461 203031838 311542 204351465 875740 203031838 This data indicates that posts on which a user has comment in a…
RHelp
  • 815
  • 2
  • 8
  • 23
-1
votes
1 answer

How to create a weighted adjacency matrix in Matlab

I have a dataset in the following format: UID Lat Long LocID u1 lt1 lg1 l1 u1 lt2 lg2 l2 u1 lt3 lg3 l3 u2 lt4 lg4 l4 u3 lt1 lg1 l1 u3 lt4 lg4 l4 From here I need to…
-1
votes
1 answer

Java Breadth First Search?

so I am trying to do a breadth first search on a list of nodes that I have but I'm not sure where to start? I have a pretty good understanding of what a breadth first search is but I have no idea how to implement it. My code is as follows: Scanner…
-1
votes
2 answers

matlab adjacency list to adjacency matrix

How to convert adjacency list to adjacency matrix via matab For example: Here is the adjacency list(undirected), the third column is the weight. 1 2 3 1 3 4 1 4 5 2 3 4 2 5 8 2 4 7 ++++++++++++++++++++++ that should be converted to: …
Jusleong
  • 113
  • 3
  • 5
  • 10
-2
votes
3 answers

How can I convert this [['1 0'], ['2 0'], ['3 1 2']] into an adjacency list in python

I have a list of the lists that contain strings, like so : [['1 0'], ['2 0'], ['3 1 2']] How can I convert it to an adjacency list in Python please like this: (all ints) { 1: 0, 2:0, 3: 1,2 } My attempts so far have gotten me to…
dingoyum
  • 25
  • 4
-2
votes
1 answer

how I can modify the diagonal of a request matrix to be zeros where i = j

I'm doing a matrix with python exporting at excel (library openpyxl) with a request by keyboard cell by cell. My question is how in that request I don't request the diagonal of the matrix and instead refill it with zeros. Here is my…
toborrm
  • 35
  • 6
-2
votes
2 answers

How to shrink a Map in Java after deleting one of its elements (objects)?

Let's assume I'm given a map represented as {[A, 0], [B, 1] [C, 2], [D, 3], [E, 4], [F, 5], [G, 6]} and were to delete one of its elements, i.e [E, 4], then my new map would become {[A, 0], [B, 1] [C, 2], [D, 3], [F, 5], [G, 6]}. How would I resize…
-2
votes
3 answers

How to convert an adjacency list into an adjacency matrix in Python

I have an adjacency list like this: 0 1 4 5 1 0 2 6 2 1 3 7 3 2 4 8 4 0 3 9 5 0 7 8 6 1 8 9 7 2 5 9 8 3 5 6 9 4 6 7 Where the first row is saying 0 is adjacent to 1, 4, and 5; the second row is saying 1 is adjacent to 0, 2, and 6; the third row is…
Stina V
  • 29
  • 4
1 2 3
59
60