Top "Adjacency-matrix" questions

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

How to 'zero' out rows & columns in an array

I have a 2D array to represent a many-many mapping : 0 3 1 3 3 0 0 0 1 0 0 0 3 0 0 0 What is the quickest way to 'zero' out rows and …

python numpy adjacency-matrix
How do I generate an adjacency matrix of a graph from a dictionary in python?

I have the following dictionary: g = { 'A': ['A', 'B', 'C'], 'B': ['A', 'C', 'E'], 'C': ['A', 'B', 'D'], 'D': ['C',…

python python-3.x dictionary matrix adjacency-matrix
Dijkstra's Algorithm using Adjacency Matrix Issue

'm trying to retrieve the shortest path between first and last node. The problem is my code always returns 0. I …

java algorithm matrix dijkstra adjacency-matrix
Creating graph from adjacency matrix in matlab

I have an adjacency matrix in matlab. How do I draw its graph? As I have >500 nodes, I cannot …

matlab graph adjacency-matrix
Permute rows and columns of a matrix

Assuming that I have the following matrix/array: array([[0, 0, 1, 1, 1], [0, 0, 1, 0, 1], [1, 1, 0, 1, 1], [1, 0, 1, 0, 0], [1, 1, 1, 0, 0]]) and I want to apply the following permutation: 1 -> 5 2 -&…

python-2.7 numpy matrix permutation adjacency-matrix
The fastest way to calculate eigenvalues of large matrices

Until now I used numpy.linalg.eigvals to calculate the eigenvalues of quadratic matrices with at least 1000 rows/columns and, …

python performance sparse-matrix eigenvalue adjacency-matrix
2-opt algorithm to solve the Travelling Salesman Problem in Python

I couldn't find any complete implementation of the 2-opt algorithm in Python so I am trying to add the missing …

python python-3.x algorithm adjacency-matrix traveling-salesman
Time Complexity of breadth first search with adjacency matrix representation?

In bfs we have to look up each node and for each node we have to look all elements of …

breadth-first-search adjacency-matrix
How to graph adjacency matrix using MATLAB

I want to create a plot showing connections between nodes from an adjacency matrix like the one below. gplot seems …

matlab matrix octave graph-theory adjacency-matrix
Computation of Path Matrix from the adjacency Matrix

I am learning the way of computing Path Matrix from Adjacency Matrix(say AM1). A Path Matrix of a graph …

graph adjacency-matrix