Creating Dependency Graph via PowerShell

Rohit 241 Reputation points
2022-12-29T12:47:45.307+00:00

Hello All,

I am referring to the below URL:
https://learn.microsoft.com/en-us/answers/questions/1127027/depender-and-dependee-variable-reallignment.html
wherein we too need to create a DAG / Dependency graph based on Depender and Dependee.

@Rich Matheisen

Below is my scenario :

$Trigger=@{} #Key vaule pair variable
$Connection=@{} #Key vaule pair variable
$Data=@{} #Key vaule pair variable

$Trigger Key Value
A {P1,P2}
B {P1,P5,B1}

$Connection Key Value
X {P1,J1}
y {P5}

$Data Key Value
S {X,R1}

Output:

274862-microsoftteams-image.png

Is there any way to create this DAG/Dependency graph in powershell based on key value variables?

Windows for business Windows Server User experience PowerShell
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Rich Matheisen 47,901 Reputation points
    2022-12-29T19:15:40.753+00:00

    I think you'd do better to use an existing dependency graphing tool. For example: generating-dependency-graphs

    Taking your example, and using Mermaid, the graph description looks like this:

    graph TD  
      A -->P1  
      A -->P2  
      B -->P1  
      B -->P5  
      B -->B1  
      X -->P1  
      X -->J1  
      Y -->P5  
      S -->R1  
      S -->X  
    

    And the result looks like this:
    274962-mermaid-diagram-2022-12-29-141359.png


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.