How to make matrix?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jovimarko
    New Member
    • Jan 2007
    • 1

    How to make matrix?

    I’ve been given a file
    1 2 15
    1 3 16
    2 3 20
    and so on…First two values of the input file represents graph nodes and the third one is distance between them. I know the number of nodes(in previous example number of nodes is 4, counting starts from 0)
    I need perl code that makes a matrix that looks like this:
    0 0 0 0
    0 0 15 16
    0 15 0 20
    0 16 20 0
    Thanks in advance!!!!!
  • miller
    Recognized Expert Top Contributor
    • Oct 2006
    • 1086

    #2
    Read the tutorial on complex data structures. There's a section specifically on "Arrays of Arrays"

    Comment

    • KevinADC
      Recognized Expert Specialist
      • Jan 2007
      • 4092

      #3
      Check your PM's Miller.

      Comment

      Working...