[Question]
  [
## What?
Let's say I have this graph:
```
   1
    \
     \
2     3
 \   /
  \ /
   4
```
I can represent it in 2 ways:
1. A list of connected vertices. `[[1,3],[2,4],[3,4]]`
2. A boolean matrix which shows where edges are:
```
c |1 2 3 4
--|-------
1 |0 0 1 0
2 |0 0 0 1
3 |1 0 0 1
4 |0 1 1 0
----- or -----
[[0,0,1,0],[0,0,0,1],[1,0,0,1],[0,1,1,0]]
```
## Task
* Your code should take input in the form of 1 (as a vertex list) and output it as 2 (as an adjacency matrix)
* The graph is not directed (aka it is an undirected graph).
* You can also accept input which is 0-indexed. For example: `[[0,2],[1,3],[2,3]]`
* This is code golf, shortest answer wins.
* You can also output 2 different values instead of 1 and 0.
## Test cases
```
[[1,2],[3,4]] -> [[0,1,0,0],[1,0,0,0],[0,0,0,1],[0,0,1,0]]
[[1,3],[2,4],[3,4]] -> [[0,0,1,0],[0,0,0,1],[1,0,0,1],[0,1,1,0]]
[[1,2],[2,3],[5,6]] -> [[0,1,0,0,0,0],[1,0,1,0,0,0],[0,1,0,0,0,0],[0,0,0,0,0,0],[0,0,0,0,0,1],[0,0,0,0,1,0]]
[[1,2]] -> [[0,1],[1,0]]
[[1,2],[4,5]] -> [[0,1,0,0,0],[1,0,0,0,0],[0,0,0,0,0],[0,0,0,0,1],[0,0,0,1,0]]
[[4,5]] -> [[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,1],[0,0,0,1,0]]
[[4,5],[2,1]] -> [[0,1,0,0,0],[1,0,0,0,0],[0,0,0,0,0],[0,0,0,0,1],[0,0,0,1,0]]
```
  
[Answer]
# [APL (Dyalog Extended)](https://github.com/abrudz/dyalog-apl-extended), 6 bytes
```
¯⍸⊢,⌽¨
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT9dNrShJzUtJTfn//9D6R707HnUt0nnUs/fQiv9pj9omPOrte9Q31dP/UVfzofXGj9omAnnBQc5AMsTDM/h/NZABVrXmUddiCDvtUccMIMsr2N/vUe/W2kMrFNSjow11jGJ1oo11TGJj1SF8YyDfCMhHFTUCi4LkTHXMkESR5U10TKF8CAsA "APL (Dyalog Extended) – Try It Online")
When given an adjacency matrix, `⍸` gives the edge list (indices of 1's). Therefore the inverse `¯⍸` solves this challenge when we add the reverse edges to the input list.
I used Extended here for the short syntax for inverse functions and because the inverse of `⍸` doesn't require its input to be sorted.
[Answer]
# [R](https://www.r-project.org/), ~~46~~ 43 bytes
*Edit: -3 bytes thanks to pajonk*
```
function(x,m=0*diag(max(x))){m[x]=1;m|t(m)}
```
[Try it online!](https://tio.run/##hZBNCsIwEEb3nqLgZiIjJP1xI/UiIlJTrV0klRAloJ691rTQVNN2NTMJ877HqJpX8nFW@lio7HZN68tdcl1WEgyKlK7yMitAZAYMIeQp9uaQsq14aRDkPVwFdSplDhwYhgQ5RBg3K8EyWO8CAIoMKVKCYKvtbEXWdc07IYsxZPRFhg3SQ253XR5zyGyGHLZkG5Dg5t/Z8Xbd3T@K1DsxZ/JZ6M5gkNlmzRnHmPhU@wMPVVyR/lQjSr/sad4Uu/4A "R – Try It Online")
Input is 2-column matrix with each row representing 2 connected vertices; output is matrix of `TRUE` and `FALSE` to indicate pairwise connections.
We could save 2 more bytes [for 41 bytes](https://tio.run/##hZDPCsIwDIfvPsXASwIZtPvjReaLiMjsdO7QTkaVgvjsc3aDddq5U5KWfL@PNK2o1ePc6GPZ5Ldr1l7uSuiqVmBIZkWVlyBzAwYRn3JvDhnfylCDxNd0EZpTpQoQwClCEhBT0q0E6yDcBQCMODFiSGCr7WwlPnTdO@JqDhl/kFGH9JD7XZfHHTJfIEc92QaktPl1drxdd/ePEfNO3Jl8FnowmGT2WUvGCaU@1fHAUxVXZDzVjNI3@z/vH7t9Aw) by returning a matrix of falsy (zero) and truthy (either `1` or `-1`) to indicate connections.
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 4 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
```
;UŒṬ
```
A monadic Link that accepts a list of pairs of positive integers (the vertex list) and yields a list of lists of `1`s and `0`s (the adjacency matrix).
**[Try it online!](https://tio.run/##y0rNyan8/9869OikhzvX/P//PzraUMcoVifaSMcYSJrqmMXGAgA "Jelly – Try It Online")** Or see the [test-suite](https://tio.run/##y0rNyan8/9869OikhzvX/D/c7m79qHG7jgOIOyNSM/L//@joaEMdo1idaGMdk9hYHQUQ1xjINQJyUQSNwIIgKVMdM4QgkqyJjimEC2bEAgA "Jelly – Try It Online").
### How?
```
;UŒṬ - Link: list of pairs of positive integers, V
 U   - reverse each pair in V
;    - V concatenate that
  ŒṬ - multi-dimensional array with 1s at those coordinates and 0s elsewhere
```
[Answer]
# [BQN](https://mlochbaum.github.io/BQN/index.html), ~~38~~ 16 bytes
*Edit: -22 bytes thanks to a change-of-approach provoked by ~~goading~~ clever hint from [ovs](https://codegolf.stackexchange.com/users/64121/ovs).*
*Edit2: changed `+` to `∨` (logical OR) so that if there are any vertices connected to themselves, which would appear on the output matrix diagonal, they are still represented as `1` and not `2`; thanks to Neil for spotting this*
```
+⟜⍉⊢∊˜·↕2⥊1+⌈´∘∾
```
[Try it at BQN online REPL](https://mlochbaum.github.io/BQN/try.html#code=Q2VsbHMg4oaQIOKIqOKfnOKNieKKouKIisucwrfihpUy4qWKMSvijIjCtOKImOKIvgpDZWxscyDin6ggMeKAvzMsIDLigL80LCAz4oC/NCwgMOKAvzAg4p+pCg==)
Uses zero-indexed input.
The [BQN](https://mlochbaum.github.io/BQN/index.html) `Range` (`↕`) function has the behaviour: "if its argument is list of numbers, then it returns an array of list indices" ([here](https://mlochbaum.github.io/BQN/doc/range.html)).  
So we just use `↕` to construct an array filled with indices, check whether each index is present in the input, and then combine the result with its transpose (to fill-in the elements corresponding to the same connections the other-way-around).
```
∨⟜⍉⊢∊˜·↕2⥊1+⌈´∘∾    # full train:
                ∾   # flatten the input connections,
             ⌈´∘    # get the maximum,
           1+       # add 1 (since 0-based indexing),
         2⥊         # duplicate it,
       ·↕           # and construct an array of 0-based 2d-coordinates;
      ˜             # now, for each 2d-coordinate,
    ⊢∊              # check if it's in the input (1) or not (0);
∨                   # finally, logical-OR the result
 ⟜⍉                 # with the transpose of itself
```
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), 14 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
Z©LãδQ.«~®ôDø~
```
The lack of builtins to check if a list is inside another list in 05AB1E is as always pretty dang annoying.. :/
[Try it online](https://tio.run/##yy9OTMpM/f8/6tBKn8OLz20J1Du0uu7QusNbXA7vqPv/PzraUMc4VifaSMcESBoDyVgA) or [verify all test cases](https://tio.run/##yy9OTMpM/V9Waa@k8KhtkoKSfeX/qEMrfQ4vPrclUO/Q6rpD6w5vcTm8o@6/zv/o6GhDHaNYnWhjHZPYWB0FENcYyDUCclEEjcCCIClTHTOEIJKsiY4phAtmxAIA).
**Explanation:**
```
Z              # Push the flattened maximum of the (implicit) input
 ©             # Store it in variable `®` (without popping)
  L            # Pop and push a list in the range [1,®]
   ã           # Cartesian product to get all pairs of this list
    δ          # Apply double-vectorized with the input-pairs:
     Q         #  Check which pairs are equal
      .«       # Then reduce this list of lists by:
        ~      #  Bitwise-OR on the bits at the same positions
         ®ô    # Split this list into parts of size `®`
           D   # Duplicate this matrix of bits
            ø  # Zip/transpose; swapping rows/columns
             ~ # Bitwise-OR the bits at the same positions again
               # (after which the result is output implicitly)
```
[Answer]
# [Python 3](https://www.python.org), ~~90~~ ~~88~~ ~~87~~ 86 bytes
*thanks to @Kevin Cruijssen for pointing out my mistake*
*thanks to @ophact for saving 2 bytes*
*thanks to @loopy walt for saving 1 byte*
*thanks to @Jonathan Allan for saving 1 byte*
```
lambda a:(r:=range(max(sum(a,[]))+1)and[[[i,j]in a or[j,i]in a for j in r]for i in r]
```
The input is a list of lists (as in the example).
# ~~85~~ ~~84~~ 83 bytes
*thanks to @loopy walt for saving 1 byte*
*thanks to @Jonathan Allan for saving 1 byte*
```
lambda a:(r:=range(max(sum(a,()))+1))and[[not{(i,j),(j,i)}&a for j in r]for i in r]
```
The input is a set of tuples.
[Answer]
# Mathematica 12, 15 bytes
```
AdjacencyMatrix
```
lol.
Mathematica can accept lists of tuples as edges in a graph, so
```
AdjacencyMatrix@{{1, 2}, {2, 3}, {3, 4}, {4, 1}}
```
produces
```
{{0, 1, 0, 1}, 
 {1, 0, 1, 0}, 
 {0, 1, 0, 1}, 
 {1, 0, 1, 0}}
```
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 24 bytes
```
≔⊕⌈Ｅθ⌈ιηＥη⭆η∨№θ⟦ιλ⟧№θ⟦λι
```
[Try it online!](https://tio.run/##S85ILErOT8z5/9@xuDgzPU/DMy@5KDU3Na8kNUXDN7EiM7c0F0gXaBTqKMC4mZpAoKOQoWnNFVCUmVcCls/QUQguAfLSoRz/Ig3n/FKgJFBjdKaOQk4sUAtCJEdHITMWZI6m9f//0dHRBjpGsTrRhjrGQNIISMbG/tctywEA "Charcoal – Try It Online") Link is to verbose version of code. 0-indexed. Outputs the boolean matrix as a string array of `0` and `1`s for convenience. Explanation:
```
≔⊕⌈Ｅθ⌈ιηＥη
```
Calculate the size of the array.
```
⭆η∨№θ⟦ιλ⟧№θ⟦λι
```
For each cell of the array, check whether it or its transpose exists within the input list.
[Answer]
# [Factor](https://factorcode.org/) + `math.matrices`, 75 bytes
```
[ 1 swap dup mmax 1 + dup 0 <matrix> [ matrix-set-nths ] keep dup flip m+ ]
```
[![enter image description here](https://i.stack.imgur.com/sKhwC.gif)](https://i.stack.imgur.com/sKhwC.gif)
## Explanation
* Create a square zero-matrix large enough to accommodate the maximum value in the input.
* Set the (zero-indexed) input coordinates in the matrix to one.
* Add the resulting matrix to its transpose.
```
                         ! { { 0 1 } }
1                        ! { { 0 1 } } 1
swap                     ! 1 { { 0 1 } }
dup                      ! 1 { { 0 1 } } { { 0 1 } }
mmax                     ! 1 { { 0 1 } } 1
1                        ! 1 { { 0 1 } } 1 1
+                        ! 1 { { 0 1 } } 2
dup                      ! 1 { { 0 1 } } 2 2
0                        ! 1 { { 0 1 } } 2 2 0
<matrix>                 ! 1 { { 0 1 } } { { 0 0 } { 0 0 } }
[ matrix-set-nths ] keep ! { { 0 1 } { 0 0 } }
dup                      ! { { 0 1 } { 0 0 } } { { 0 1 } { 0 0 } }
flip                     ! { { 0 1 } { 0 0 } } { { 0 0 } { 1 0 } }
m+                       ! { { 0 1 } { 1 0 } }
```
[Answer]
# [JavaScript (Node.js)](https://nodejs.org), 98 bytes
```
x=>[...Array(eval(`1+Math.max(${x})`))].map((_,i,t)=>t.map((_,j)=>x.some(v=>v==i+[,j]|v==j+[,i])))
```
[Try it online!](https://tio.run/##rZI9T8MwEIZ3fkUGBptc3bgfLMiRWJGAgTFYxG2dkihtKsdEqSi/PVySorgFwcJ0H/Y999p6M1WpcmnSnR1ti5VuEtHUIowYY7fGqD3RlcpJzP17ZV/ZRtXk8r3@oDGlEqsdIS@QgqUitF9lhkXNymKjSSXCSojUjyCTB8wyzFJJKW1uvPgiijhMJERTmEnpjUIvigLgEECAzS52WReBHzPsS9mNTrEzwdEzQH/FHeMOgDuASQdoMXO4PlPgqHCVuGcBBD9W3KncZcOCHuyomMH82/7hD075Ln145hF3Avp9@G9Q@zv8P3TFzOhdrpaajAm7oi2wjeM1eOgXBQt0zLLYlkWuWV6sidGluHt6fGClNel2nSZ7kvQ@VAPpeeUjwKLxRhwdRYcTa970IVF5qfsLfjdqKQWvJYsF@u8T "JavaScript (Node.js) – Try It Online")
:(
[Answer]
# [Haskell](https://www.haskell.org/), ~~66~~ 63 bytes
```
f x|r<-[1..maximum$id=<<x]=[[elem[i,j]x||elem[j,i]x|j<-r]|i<-r]
```
[Try it online!](https://tio.run/##rZA9D4IwEIZ3fsUNDpocpMWPCUYHBze35gaMEIsUCGrCwH/HUgi2iTEOdrhe767Pe3fX5H5Li6LvM2i7JvIFDwKVtFI91UJe4ihqKRYiLVIlJObUdp3xc5TazyO/oU4Otj9XVXGqDuUDYlBJDcvBZE2l9uVTrTxPJbIcU0dY1o3UhQG8PwWQrUB4AEJwDAnFGjdECOPxfR1nyJEh0zlzG8/cyCdPx4kmxlrHQs2YSRNjrLJ/covBHUZoGANpizuLMenPvdj92DmG7OOLWy9Xb57YnXvUcfra4PbzfuwNubq26nsDM9chOtzvrF@4wx45EfyvX@pf "Haskell – Try It Online")
Uses `True` and `False` for the output.
[Answer]
# [PDL](https://metacpan.org/pod/PDL) (Perl Data Language) 81 chars (the second paragraph)
```
use PDL;
use PDL::NiceSlice;
$_ = [[1,3],[2,4],[3,4]];
$i=pdl($_)-1;
$m=zeroes("$_",$_)for$i->max+1;
$m->indexND($i->glue(1,$i(-1:0))).=1;
print $m;
```
Explanation per line:
* construct indices ndarray, turn 1-based to 0-based
* find highest index+1; make square matrix that size; `""` is to coerce to Perl scalar not ndarray as `zeroes` with ndarray first arg copies its dimensions
* `$i(-1:0)` reverses order of indices in 0th dimension, i.e. symmetrises; `glue(1,...)` adds rows; `indexND` selects the given elements; set them to 1
]