EdgeQ
Examples
open all close allScope (8)
EdgeQ works with undirected graphs:
EdgeQ returns False for items that are not edge expressions:
Rules can be used to test for directed edges:
When g is not a graph, EdgeQ[g,e] evaluates to False:
Verify that g is not a graph using GraphQ:
EdgeQ works with large graphs:
Compare performance with a test based on EdgeList:
Applications (3)
Properties & Relations (4)
EdgeQ[g,uv] is equivalent to MemberQ[EdgeList[g],uv]:
The performance of EdgeQ is typically higher:
EdgeQ[g,uv] is equivalent to MemberQ[EdgeList[g],uv|vu]:
The performance of EdgeQ is typically higher:
Use EdgeIndex to find the position of an edge in EdgeList[g]:
EdgeIndex is typically faster than Position:
Use VertexQ to test whether a vertex is part of a graph:
See Also
UndirectedEdge DirectedEdge EdgeList EdgeCount EdgeIndex Graph VertexQ GraphQ
Function Repository: EdgeBetweenQ
Related Guides
History
Text
Wolfram Research (2010), EdgeQ, Wolfram Language function, https://reference.wolfram.com/language/ref/EdgeQ.html.
CMS
Wolfram Language. 2010. "EdgeQ." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/EdgeQ.html.
APA
Wolfram Language. (2010). EdgeQ. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/EdgeQ.html
BibTeX
@misc{reference.wolfram_2025_edgeq, author="Wolfram Research", title="{EdgeQ}", year="2010", howpublished="\url{https://reference.wolfram.com/language/ref/EdgeQ.html}", note=[Accessed: 13-August-2025]}
BibLaTeX
@online{reference.wolfram_2025_edgeq, organization={Wolfram Research}, title={EdgeQ}, year={2010}, url={https://reference.wolfram.com/language/ref/EdgeQ.html}, note=[Accessed: 13-August-2025]}