Hi @AnaGuerrero,
well, printing a 100kx100k matrix on the screen doesn't make much sense. And if you want it to save to a file, you shouldn't use plain text, but binary, i.e. 'packed' format, especially for a (large) boolean matrix.
Below is a very simple approach in py3, that uses a tuple (row, col) as dict key and that assumes that row and col are integers. Since the matrix is symmetric (as given by your in- and output), the transposed element (col, row) does not have to be stored separately. (row, col) elements which are not seen in the input data won't be created resp. stored.
The dimension d is determined dynamically, but could also simply be passed as an argument to the script or be statically set.
You could also use a 2D array resp. list, but then the size should be known beforehand in order not to have to allocate memory dynamically while reading in the data, which in general costs some more time (for large data). It also has the disadvantage that it always has to contain d*d elements - unless you only save the part above the diagonal incl. the diagonal itself, i.e. d+(d-1)+..+1 = d*(d+1)/2 elements, a bit more than the half of the former. As far as access speed is concerned, list access m[r][c] normally is a bit faster than dict access m[(r, c)]. But, as already mentioned by @munkeHoller, for working with arrays/matrices, numpy is a good choice, especially when processing large amounts of data.
There are also optimized storage methods for sparse and/or boolean matrices, see e.g. Sparse matrix - Wikipedia or https://stackoverflow.com/questions/9243004/storing-large-amount-of-boolean-data-in-python.
d = 0 # dimension of matrix
m = {} # the matrix
with open("infile") as fin:
for (a, b) in [ln.strip().split(",") for ln in fin]:
r, c = int(a), int(b)
m[(r, c)] = 1
d = max(r, c, d)
# printing aligned row & col no. omitted
for r in range(1, d+1):
for c in range(1, d+1):
# dict.get(unknown_key) returns None
print(m.get((r, c)) or m.get((c, r)) or 0, end=" ")
# or, by converting bool to int
#print(int((r, c) in m or (c, r) in m), end=" ")
print()