Description: bmp2a.m is a MATLAB program that tries to convert bitmap sketches of networks into their matrix representations. Input: The first input argument is the name of the bitmap image. The second argument is the number of boundary nodes. The third agrument is the number of interior nodes. The second and third arguments are optional, but may help if the program fails to automatically detect the correct number of nodes. Output: 1. A node-node incidence matrix called Inc. 2. Kirchhoff matrix K with symbolic conductances. 3. Diagonal matrix C with symbolic conductances on diagonal. 4. Edge-node incidence matrix A. 5. A struct containing edge information, edge. For example, edge(k).i and edge(k).j are the nodes edge k is connected to. 6. A labeled figure representating the program's interpretation of the inputted sketch. Note that K = A'*C*A Usage: [Inc,K,C,A,edge] = bmp2a(img,n,m); If the bitmap is called mybmp.bmp, the number of boundary nodes is 8 and the number of interior nodes is 4, then the function can be called by [Inc,K,C,A,edge] = bmp2a('mybmp.bmp',8,4); To omit the interior node argument, one can use [Inc,K,C,A,edge] = bmp2a('mybmp.bmp',8); To omit both boundary and interior node arguments one can simply use [Inc,K,C,A,edge] = bmp2a('mybmp.bmp'); Comments: Detection of the edges may take a minute or two, but the program should draw the detected nodes before this stage so you can see if it's on the right track or not. Success is not guaranteed. There are some mighty fudge factors in this code. When sketching the network (black on white), one should denote the boundary nodes with solid discs of about the same size and bigger than interior nodes. The edges should be about the same width. Use solid lines to make sure everything's connected. One pixel wide lines are fine. It's not in general necessary to put small dots on the interior nodes. The nodes shouldn't be too close together. The program will run faster on smaller bitmaps. Ms Paint works well enough to quickly sketch bitmap images of networks. It works well to save as a monochrome bitmap, but this isn't necessary in general.