I am trying to define an edge set as follows: $\mathcal{E}=\{(i,j)|i,j\in\mathcal{V}\land T_{ij}\leq R \land \text{$i$ and $j$ are not jointly in $\mathcal{K}$\}}$, where $\mathcal{V}$ is the set of vertices, $\mathcal{K}$ is a subset of vertices $\mathcal{K}\subset\mathcal{V}$, $T_{ij}$ is the travel time between $i$ and $j$, and $R$ is a travel time threshold. So, I would like to create an edge including all edges satisfying the travel time condition and $i$ and $j$ cannot be both in $\mathcal{K}$ at the same time. To better convey, if $i\in\mathcal{K}$ and $j\in\mathcal{K}$, regardless of the travel time condition ($T_{ij}\leq R$), $(i,j)\notin\mathcal{E}$. How can I properly write this notation?

While writing the question, I realized the following can be right, can it? $\mathcal{E}=\{(i,j)|i,j\in\mathcal{V}\land T_{ij}\leq R\}\setminus\{(i,j)|i,j\in\mathcal{V}\land i,j\in\mathcal{K}\}$


1 Answer 1


Yes, that looks correct, although you can simplify a bit because $\mathcal{K} \subset \mathcal{V}$: $$\mathcal{E}=\{(i,j)|i,j\in\mathcal{V}\land T_{ij}\leq R\} \setminus \{(i,j)|i,j\in\mathcal{K}\}$$

Here are two other ways: $$\mathcal{E}=\{(i,j)|i,j\in\mathcal{V}\land T_{ij}\leq R\land \neg(i\in\mathcal{K} \land j\in\mathcal{K})\}$$ $$\mathcal{E}=\{(i,j)|i,j\in\mathcal{V}\land T_{ij}\leq R\land (i\notin\mathcal{K} \lor j\notin\mathcal{K})\}$$

  • $\begingroup$ Thanks for the verification, Rob. I will prefer your second way which perfectly reads what I mean. $\endgroup$
    – tcokyasar
    Jun 26, 2020 at 2:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.