# Question:Getting an undirected weigthed graph a given type of table under certain conditions

## Question:Getting an undirected weigthed graph a given type of table under certain conditions

Maple

Have a output of similar below form

say

output := table([(3, 6) = ["C-C", 0.99414575], (3, 4) = ["C-C", 1.00000000], (6, 13) = ["C-H", 1.11484141], (2, 7) = ["O-C", 0.99996130], (3, 5) = ["C-C", 1.60953223], (4, 7) = ["C-C", 0.99414575], (3, 7) = ["C-C", 1.61174619], (10, 16) = ["C-H", 0.61996904], (3, 8) = ["C-C", 0.99997800], (6, 7) = ["C-C", 1.60940000], (5, 12) = ["C-H", 0.61992962], (5, 6) = ["C-C", 0.99404781], (8, 10) = ["C-C", 0.99997800], (5, 13) = ["C-H", 0.61992962], (11, 17) = ["C-H", 0.61996904], (4, 5) = ["C-C", 1.60953223], (9, 15) = ["C-H", 0.62000000], (9, 11) = ["C-C", 0.99997800], (4, 6) = ["C-C", 1.61174619], (4, 9) = ["C-C", 0.99997800], (5, 7) = ["C-C", 0.99404781], (10, 11) = ["C-C", 1.00000000], (1, 6) = ["O-C", 0.99996130], (7, 12) = ["C-H", 1.11484141], (8, 14) = ["C-H", 0.62000000]])

Create a function which take the above table as and ouputs an weighted undirected Graph G.

I would like to get undirected graph such that

condition

1) We need to form a square matrix say A1 of dimension n cross n where n is the larges among all the integers in the (i,j) that list the above example 17 is the highest among all of the (i,j) sets.

2) then form a weighted square matrix 17 cross 17 where second element of the inside list has to be wiegth in that position

That is the in the matrix (3,6) and (6,3) should have weight  0.99414575,  in the matrix (3,4) and (4,3) should have weight 1.00000000 etc.

3) Then we need to remove all rows and columns which matches to H

That

(10, 16) = ["C-H", 0.61996904] here H goes for 16 so we remove Row 16 and Column 16 of A1

again (5, 12) = ["C-H", 0.61992962] here H goes for 12 so we remove Row 12 and Column 12 of A1

so if we could remove all rows and coulmns where H is their in A1 in one go

as if I remove one row and columns then immedialety row and column number will changes so need to be very careful.

Then the function changes the square weighted matrix to a graph outputs the graph.

The table will of similar form but only thing is number of elements in the table can change.

Kind help

﻿