Advertisement
Guest User

Untitled

a guest
Sep 17th, 2014
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. F = file('/Users/Me/Desktop/latex/adjmat.txt','r')
  2. L = map(lambda x: x.split(';'),F.readlines())[0]
  3. L = [L[0][1:]] + L[1:-1] + [L[-1][:-1]]
  4. F.close
  5. S = ''
  6. for i in range(len(L)):
  7. tempL = map(lambda x: x.split(','),[L[i]])[0]
  8. for j in range(i+1,len(tempL)):
  9. if tempL[j] == '1':
  10. S += '\draw (p%g)--(p%g);n'%(i+1,j+1)
  11. G = file('/Users/Me/Desktop/latex/adjmat-tikz.txt','w')
  12. G.write(S[:-1])
  13. G.close
  14.  
  15. [0,1,0;1,0,1;0,1,0]
  16.  
  17. begin{tikzpicture}
  18. node[circle,fill=black,inner sep=1pt] (p1) at (0,0) {};
  19. node[circle,fill=black,inner sep=1pt] (p2) at (1,0) {};
  20. node[circle,fill=black,inner sep=1pt] (p3) at (1,1) {};
  21. input{adjmat-tikz.txt}
  22. end{tikzpicture}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement