Skip to main content
Notice removed Improve details by Tugrul Temel
Bounty Ended with kglr's answer chosen by Tugrul Temel
Tweeted twitter.com/StackMma/status/1199478105531920384
Notice added Improve details by Tugrul Temel
Bounty Started worth 50 reputation by Tugrul Temel
deleted 441 characters in body
Source Link
Tugrul Temel
  • 6.4k
  • 3
  • 15
  • 35

Given a matrix mat:

mat = {{1, 5, 2, 6}, {4, 3, 4, 1}, {0, 1, 4, 0}, {2, 1, 3, 4}}; 

I want to apply the following conditions to generate various directed graphs.

  1. Denote columns by A, B, C, D
  2. Choose a column, say A (1st column), and find the binary relations between A and those cells with a number higher than 25% (threshold) of the respective column total. For example, for column A, BA and DA will be selected as the ratios (4/7 and 2/7) will be higher than 25%, respectively.
  3. Then choose column B because we obtained BA at step 2 and repeat the same procedure at step 2 to find those relations above 25% of the total of column B; next do the same operation for the second relation obtained in step 2, which is DA.
  4. Next, choose column C and follow the same operations in step 2 end so on...
  5. Generate a directed graph of all the significant relations obtained from the matrix mat.

After completing the visits to all of the columns, then apply the same steps (1-4 above) to the transpose of the matrix mat to generate another directed graph of the resulting relations.

I want to generate:

  1. two directed graphs: one for column-wise operation (subgraph1) and another for row-wise operation (subgraph2) and
  2. another directed graph combining the two directed graphs in (1) with different colors to differentiate the column-wise and row-wise graphs.

I like to produce these directed graphs using a function f[mat,th,column#] for automated generation of the directed graphs using mat by choosing a specific column (for example, A as column#) and a given threshold th, and another function g[subgraph1, subgraph2, column#]to combine the individual graphs.

UPDATE with an example Below, please see the two outputs expected from the procedure described above. I did the exercise for only two columns, but in reality, I am supposed to visit all the vertices in the matrix. I hope the expected outcomes are clear.

enter image description here

enter image description here

UPDATE 2 Please ignore the above two pictures as they contain some mistakes. Below, I give the updated versions ofupdate the pictures (4 pages)question with an example explaining the steps for the code development.

Starting node A:

enter image description here

Starting node B:

enter image description here

Staring node C:

enter image description here

Starting node D:

enter image description here

Given a matrix mat:

mat = {{1, 5, 2, 6}, {4, 3, 4, 1}, {0, 1, 4, 0}, {2, 1, 3, 4}}; 

I want to apply the following conditions to generate various directed graphs.

  1. Denote columns by A, B, C, D
  2. Choose a column, say A (1st column), and find the binary relations between A and those cells with a number higher than 25% (threshold) of the respective column total. For example, for column A, BA and DA will be selected as the ratios (4/7 and 2/7) will be higher than 25%, respectively.
  3. Then choose column B because we obtained BA at step 2 and repeat the same procedure at step 2 to find those relations above 25% of the total of column B; next do the same operation for the second relation obtained in step 2, which is DA.
  4. Next, choose column C and follow the same operations in step 2 end so on...
  5. Generate a directed graph of all the significant relations obtained from the matrix mat.

After completing the visits to all of the columns, then apply the same steps (1-4 above) to the transpose of the matrix mat to generate another directed graph of the resulting relations.

I want to generate:

  1. two directed graphs: one for column-wise operation (subgraph1) and another for row-wise operation (subgraph2) and
  2. another directed graph combining the two directed graphs in (1) with different colors to differentiate the column-wise and row-wise graphs.

I like to produce these directed graphs using a function f[mat,th,column#] for automated generation of the directed graphs using mat by choosing a specific column (for example, A as column#) and a given threshold th, and another function g[subgraph1, subgraph2, column#]to combine the individual graphs.

UPDATE with an example Below, please see the two outputs expected from the procedure described above. I did the exercise for only two columns, but in reality, I am supposed to visit all the vertices in the matrix. I hope the expected outcomes are clear.

enter image description here

enter image description here

UPDATE 2 Please ignore the above two pictures as they contain some mistakes. Below, I give the updated versions of the pictures (4 pages) explaining the steps for the code development.

Starting node A:

enter image description here

Starting node B:

enter image description here

Staring node C:

enter image description here

Starting node D:

enter image description here

Given a matrix mat:

mat = {{1, 5, 2, 6}, {4, 3, 4, 1}, {0, 1, 4, 0}, {2, 1, 3, 4}}; 

I want to apply the following conditions to generate various directed graphs.

  1. Denote columns by A, B, C, D
  2. Choose a column, say A (1st column), and find the binary relations between A and those cells with a number higher than 25% (threshold) of the respective column total. For example, for column A, BA and DA will be selected as the ratios (4/7 and 2/7) will be higher than 25%, respectively.
  3. Then choose column B because we obtained BA at step 2 and repeat the same procedure at step 2 to find those relations above 25% of the total of column B; next do the same operation for the second relation obtained in step 2, which is DA.
  4. Next, choose column C and follow the same operations in step 2 end so on...
  5. Generate a directed graph of all the significant relations obtained from the matrix mat.

After completing the visits to all of the columns, then apply the same steps (1-4 above) to the transpose of the matrix mat to generate another directed graph of the resulting relations.

I want to generate:

  1. two directed graphs: one for column-wise operation (subgraph1) and another for row-wise operation (subgraph2) and
  2. another directed graph combining the two directed graphs in (1) with different colors to differentiate the column-wise and row-wise graphs.

I like to produce these directed graphs using a function f[mat,th,column#] for automated generation of the directed graphs using mat by choosing a specific column (for example, A as column#) and a given threshold th, and another function g[subgraph1, subgraph2, column#]to combine the individual graphs.

UPDATE Below, I update the question with an example explaining the steps for the code development.

Starting node A:

enter image description here

Starting node B:

enter image description here

Staring node C:

enter image description here

Starting node D:

enter image description here

First update of the question had some mistakes and therefore I updated it for the second time to show all the steps involved in the development of the code.
Source Link
Tugrul Temel
  • 6.4k
  • 3
  • 15
  • 35

Given a matrix mat:

mat = {{1, 5, 2, 6}, {4, 3, 4, 1}, {0, 1, 4, 0}, {2, 1, 3, 4}}; 

I want to apply the following conditions to generate various directed graphs.

  1. Denote columns by A, B, C, D
  2. Choose a column, say A (1st column), and find the binary relations between A and those cells with a number higher than 25% (threshold) of the respective column total. For example, for column A, BA and DA will be selected as the ratios (4/7 and 2/7) will be higher than 25%, respectively.
  3. Then choose column B because we obtained BA at step 2 and repeat the same procedure at step 2 to find those relations above 25% of the total of column B; next do the same operation for the second relation obtained in step 2, which is DA.
  4. Next, choose column C and follow the same operations in step 2 end so on...
  5. Generate a directed graph of all the significant relations obtained from the matrix mat.

After completing the visits to all of the columns, then apply the same steps (1-4 above) to the transpose of the matrix mat to generate another directed graph of the resulting relations.

I want to generate:

  1. two directed graphs: one for column-wise operation (subgraph1) and another for row-wise operation (subgraph2) and
  2. another directed graph combining the two directed graphs in (1) with different colors to differentiate the column-wise and row-wise graphs.

I like to produce these directed graphs using a function f[mat,th,column#] for automated generation of the directed graphs using mat by choosing a specific column (for example, A as column#) and a given threshold th, and another function g[subgraph1, subgraph2, column#]to combine the individual graphs.

UPDATE with an example Below, please see the two outputs expected from the procedure described above. I did the exercise for only two columns, but in reality, I am supposed to visit all the vertices in the matrix. I hope the expected outcomes are clear.

enter image description here

enter image description here

UPDATE 2 Please ignore the above two pictures as they contain some mistakes. Below, I give the updated versions of the pictures (4 pages) explaining the steps for the code development.

Starting node A:

enter image description here

Starting node B:

enter image description here

Staring node C:

enter image description here

Starting node D:

enter image description here

Given a matrix mat:

mat = {{1, 5, 2, 6}, {4, 3, 4, 1}, {0, 1, 4, 0}, {2, 1, 3, 4}}; 

I want to apply the following conditions to generate various directed graphs.

  1. Denote columns by A, B, C, D
  2. Choose a column, say A (1st column), and find the binary relations between A and those cells with a number higher than 25% (threshold) of the respective column total. For example, for column A, BA and DA will be selected as the ratios (4/7 and 2/7) will be higher than 25%, respectively.
  3. Then choose column B because we obtained BA at step 2 and repeat the same procedure at step 2 to find those relations above 25% of the total of column B; next do the same operation for the second relation obtained in step 2, which is DA.
  4. Next, choose column C and follow the same operations in step 2 end so on...
  5. Generate a directed graph of all the significant relations obtained from the matrix mat.

After completing the visits to all of the columns, then apply the same steps (1-4 above) to the transpose of the matrix mat to generate another directed graph of the resulting relations.

I want to generate:

  1. two directed graphs: one for column-wise operation (subgraph1) and another for row-wise operation (subgraph2) and
  2. another directed graph combining the two directed graphs in (1) with different colors to differentiate the column-wise and row-wise graphs.

I like to produce these directed graphs using a function f[mat,th,column#] for automated generation of the directed graphs using mat by choosing a specific column (for example, A as column#) and a given threshold th, and another function g[subgraph1, subgraph2, column#]to combine the individual graphs.

UPDATE with an example Below, please see the two outputs expected from the procedure described above. I did the exercise for only two columns, but in reality, I am supposed to visit all the vertices in the matrix. I hope the expected outcomes are clear.

enter image description here

enter image description here

Given a matrix mat:

mat = {{1, 5, 2, 6}, {4, 3, 4, 1}, {0, 1, 4, 0}, {2, 1, 3, 4}}; 

I want to apply the following conditions to generate various directed graphs.

  1. Denote columns by A, B, C, D
  2. Choose a column, say A (1st column), and find the binary relations between A and those cells with a number higher than 25% (threshold) of the respective column total. For example, for column A, BA and DA will be selected as the ratios (4/7 and 2/7) will be higher than 25%, respectively.
  3. Then choose column B because we obtained BA at step 2 and repeat the same procedure at step 2 to find those relations above 25% of the total of column B; next do the same operation for the second relation obtained in step 2, which is DA.
  4. Next, choose column C and follow the same operations in step 2 end so on...
  5. Generate a directed graph of all the significant relations obtained from the matrix mat.

After completing the visits to all of the columns, then apply the same steps (1-4 above) to the transpose of the matrix mat to generate another directed graph of the resulting relations.

I want to generate:

  1. two directed graphs: one for column-wise operation (subgraph1) and another for row-wise operation (subgraph2) and
  2. another directed graph combining the two directed graphs in (1) with different colors to differentiate the column-wise and row-wise graphs.

I like to produce these directed graphs using a function f[mat,th,column#] for automated generation of the directed graphs using mat by choosing a specific column (for example, A as column#) and a given threshold th, and another function g[subgraph1, subgraph2, column#]to combine the individual graphs.

UPDATE with an example Below, please see the two outputs expected from the procedure described above. I did the exercise for only two columns, but in reality, I am supposed to visit all the vertices in the matrix. I hope the expected outcomes are clear.

enter image description here

enter image description here

UPDATE 2 Please ignore the above two pictures as they contain some mistakes. Below, I give the updated versions of the pictures (4 pages) explaining the steps for the code development.

Starting node A:

enter image description here

Starting node B:

enter image description here

Staring node C:

enter image description here

Starting node D:

enter image description here

added 430 characters in body
Source Link
Tugrul Temel
  • 6.4k
  • 3
  • 15
  • 35

Given a matrix mat:

mat = {{1, 5, 2, 6}, {4, 3, 4, 1}, {0, 1, 4, 0}, {2, 1, 3, 4}}; 

I want to apply the following conditions to generate various directed graphs.

  1. Denote columns by A, B, C, D
  2. Choose a column, say A (1st column), and find the binary relations between A and those cells with a number higher than 25% (threshold) of the respective column total. For example, for column A, BA and DA will be selected as the ratios (4/7 and 2/7) will be higher than 25%, respectively.
  3. Then choose column B because we obtained BA at step 2 and repeat the same procedure at step 2 to find those relations above 25% of the total of column B; next do the same operation for the second relation obtained in step 2, which is DA.
  4. Next, choose column C and follow the same operations in step 2 end so on...
  5. Generate a directed graph of all the significant relations obtained from the matrix mat.

After completing the visits to all of the columns, then apply the same steps (1-4 above) to the transpose of the matrix mat to generate another directed graph of the resulting relations.

I want to generate:

  1. two directed graphs: one for column-wise operation (subgraph1) and another for row-wise operation (subgraph2) and
  2. another directed graph combining the two directed graphs in (1) with different colors to differentiate the column-wise and row-wise graphs.

I like to produce these directed graphs using a function f[mat,th,column#] for automated generation of the directed graphs using mat by choosing a specific column (for example, A as column#) and a given threshold th, and another function g[subgraph1, subgraph2, column#]to combine the individual graphs.

UPDATE with an example Below, please see the two outputs expected from the procedure described above. I did the exercise for only two columns, but in reality, I am supposed to visit all the vertices in the matrix. I hope the expected outcomes are clear.

enter image description here

enter image description here

Given a matrix mat:

mat = {{1, 5, 2, 6}, {4, 3, 4, 1}, {0, 1, 4, 0}, {2, 1, 3, 4}}; 

I want to apply the following conditions to generate various directed graphs.

  1. Denote columns by A, B, C, D
  2. Choose a column, say A (1st column), and find the binary relations between A and those cells with a number higher than 25% (threshold) of the respective column total. For example, for column A, BA and DA will be selected as the ratios (4/7 and 2/7) will be higher than 25%, respectively.
  3. Then choose column B because we obtained BA at step 2 and repeat the same procedure at step 2 to find those relations above 25% of the total of column B; next do the same operation for the second relation obtained in step 2, which is DA.
  4. Next, choose column C and follow the same operations in step 2 end so on...
  5. Generate a directed graph of all the significant relations obtained from the matrix mat.

After completing the visits to all of the columns, then apply the same steps (1-4 above) to the transpose of the matrix mat to generate another directed graph of the resulting relations.

I want to generate:

  1. two directed graphs: one for column-wise operation (subgraph1) and another for row-wise operation (subgraph2) and
  2. another directed graph combining the two directed graphs in (1) with different colors to differentiate the column-wise and row-wise graphs.

I like to produce these directed graphs using a function f[mat,th,column#] for automated generation of the directed graphs using mat by choosing a specific column (for example, A as column#) and a given threshold th, and another function g[subgraph1, subgraph2, column#]to combine the individual graphs.

Given a matrix mat:

mat = {{1, 5, 2, 6}, {4, 3, 4, 1}, {0, 1, 4, 0}, {2, 1, 3, 4}}; 

I want to apply the following conditions to generate various directed graphs.

  1. Denote columns by A, B, C, D
  2. Choose a column, say A (1st column), and find the binary relations between A and those cells with a number higher than 25% (threshold) of the respective column total. For example, for column A, BA and DA will be selected as the ratios (4/7 and 2/7) will be higher than 25%, respectively.
  3. Then choose column B because we obtained BA at step 2 and repeat the same procedure at step 2 to find those relations above 25% of the total of column B; next do the same operation for the second relation obtained in step 2, which is DA.
  4. Next, choose column C and follow the same operations in step 2 end so on...
  5. Generate a directed graph of all the significant relations obtained from the matrix mat.

After completing the visits to all of the columns, then apply the same steps (1-4 above) to the transpose of the matrix mat to generate another directed graph of the resulting relations.

I want to generate:

  1. two directed graphs: one for column-wise operation (subgraph1) and another for row-wise operation (subgraph2) and
  2. another directed graph combining the two directed graphs in (1) with different colors to differentiate the column-wise and row-wise graphs.

I like to produce these directed graphs using a function f[mat,th,column#] for automated generation of the directed graphs using mat by choosing a specific column (for example, A as column#) and a given threshold th, and another function g[subgraph1, subgraph2, column#]to combine the individual graphs.

UPDATE with an example Below, please see the two outputs expected from the procedure described above. I did the exercise for only two columns, but in reality, I am supposed to visit all the vertices in the matrix. I hope the expected outcomes are clear.

enter image description here

enter image description here

edited tags
Link
C. E.
  • 71.7k
  • 7
  • 144
  • 279
Loading
added 76 characters in body
Source Link
Tugrul Temel
  • 6.4k
  • 3
  • 15
  • 35
Loading
Source Link
Tugrul Temel
  • 6.4k
  • 3
  • 15
  • 35
Loading