title: How to check if a matrix is antisymmetric
body: <p>Here's my code to check if a matrix is antisymmetric. (A relation R on a set A is called antisymmetric if and only if for any a, and b in A, whenever (a,b) in R , and (b,a) in R , a = b must hold.)</p>
  
  <pre><code>// AntiSymmetric
  public static boolean checkAntisymmetric(Graph graph, int vertices){
      boolean antisymmetric = false;
      for(int i = 1; i &lt;= vertices; i++) {
          for(int j = 1; j &lt;= vertices; j++){
              if((graph.getEdge(i, j) == graph.getEdge(j, i)) &amp;&amp; (i == j)){
                  antisymmetric = true;
                  break;
              }
          }
      }
      if(antisymmetric){
          return true;
      }
      else {
          return false;
      }
  }
  </code></pre>
  
  <p>And my getEdge function is:</p>
  
  <pre><code>public int getEdge(int to, int from){
      try{
          return adjencencyMatrix[to][from];
      } catch(ArrayIndexOutOfBoundsException index){
          System.out.println("Vertices does not exist");
      }
      return -1;
  }
  </code></pre>
  
  <p>For example, if I give the edges represented by pairs: (2,3) (3,5) (3,2) (5,1) (4,4)
  It should be return false because of (4,4).
  Additionally I used this as reference:<a href="https://i.stack.imgur.com/2RZaC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2RZaC.png" alt="Representing Relations"></a> </p>
  
  <p>I was able to create a function in which checks if a matrix is indeed symmetric. The only thing different is that my anti-symmetric function has the condition (i == j) within the if statement. Could someone see why it's always returning true? Thanks.
  An example Matrix I've been using to test the function is shown here:</p>
  
  <pre><code>0 0 0 0 0
  0 0 1 0 0
  0 1 0 0 1
  0 0 0 0 0
  1 0 0 0 0
  </code></pre>
  
  <p>For the pairs: (2,3) (3,5) (3,2) (5,1)</p>