# How to read a undirected graph stored in a Adjacency Matrix?

**URL:** <https://igraph.discourse.group/t/how-to-read-a-undirected-graph-stored-in-a-adjacency-matrix/570>\
**Category:** Usage\
**Tags:** Python\
**Created:** [3 January 2021 08:52 UTC](https://igraph.discourse.group/t/how-to-read-a-undirected-graph-stored-in-a-adjacency-matrix/570 "2021-01-03T08:52:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zhoujr94](https://yyz2.discourse-cdn.com/free1/user_avatar/igraph.discourse.group/zhoujr94/32/427_2.png) [@Zhoujr94](https://igraph.discourse.group/u/Zhoujr94)\
**Post date:** [3 January 2021 08:52 UTC](https://igraph.discourse.group/t/how-to-read-a-undirected-graph-stored-in-a-adjacency-matrix/570/1 "2021-01-03T08:52:21Z")

</div>

`g = igraph.Graph.Read_Adjacency(-f"../graf.txt',sep=None, comment_char='#',attribute="weighted")`

The adjacency matrix is stored in the txt, and it is a symmetric matrix.“g” is a directed graph,and I need a undirected graph.

---

<div class="post-metadata">

**Author:** ![szhorvat](https://yyz2.discourse-cdn.com/free1/user_avatar/igraph.discourse.group/szhorvat/32/3_2.png) [@szhorvat](https://igraph.discourse.group/u/szhorvat)\
**Post date:** [4 January 2021 11:08 UTC](https://igraph.discourse.group/t/how-to-read-a-undirected-graph-stored-in-a-adjacency-matrix/570/2 "2021-01-04T11:08:58Z")

</div>

I have not tried it, but the [documentation](https://igraph.org/python/doc/igraph.Graph-class.html#Read_Adjacency) says,

> Additional positional and keyword arguments not mentioned here are passed intact to [Graph.Adjacency](https://igraph.org/python/doc/igraph.GraphBase-class.html#Adjacency).

Thus, I would add `mode=igraph.ADJ_UNDIRECTED` as a keyword argument.
