Python Forum
Remove isolated vertices from dictionary and adjacency matrix
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Remove isolated vertices from dictionary and adjacency matrix
Greetings Community,

I have a dictionary and an adjacency matrix looking as follows:
dict: {0: (171,331, 1: (168,358), ...} (a list of vertices with coordinates)
adjacency matrix: 2d array which only contains zeros and ones for connected (1) or unconnected (0)

The two structures are connected in a way that the order of the adjacency matrix is equal to the enumeration of the dictionary.

Now I would like to be able to remove all isolated vertices (where row/column only contains zeros) from the adjacency matrix and also from the dictionary.

Is there a way to do this properly in python? Would you recommend a different data structure in python?
Not relevant anymore, my implementation is not giving me the expected result anyway, will have to look into the networkx bibliography and see if it is possible to generate random connected graphs with given minimum node degree. Even better would be unit disc graphs but I doubt I find that.

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to multiply a matrix with herself, until the zero matrix results peanutbutterandjelly 3 755 May-03-2021, 06:30 AM
Last Post: Gribouillis
  finding element of specific field in pandas adjacency matrix amjass12 0 384 Oct-27-2020, 09:27 AM
Last Post: amjass12
  Create an isolated section in bash? yxk 1 699 Feb-27-2020, 11:16 AM
Last Post: Larz60+
  How to remove apostrophes in a matrix sylas 4 1,743 May-06-2018, 05:07 PM
Last Post: killerrex
  matrix from matrix python numpy array shei7141 1 2,216 Jan-16-2017, 06:10 PM
Last Post: micseydel

Forum Jump:

User Panel Messages

Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020