As @whoAmI pointed out, assuming that the network
is directed, you want to be asking for the successors rather than the neighbors.
However, there is a more elegant and efficient way of doing this. What you actually want is the outgoing edges, so ask for them directly:
for (Transaction transaction : network.getOutgoingEdges(customer)) {
// get the other customer for this transaction
Customer otherCustomer = network.getOpposite(customer, transaction);
otherCustomer.setChurnProb(transaction.getWeight());
churnedNet.add(customer);
}
You shouldn't need to ask if the outgoing edges (or the neighbors) are null, because that should always return an empty Collection if there are no edges/neighbors.
That said, this logic doesn't make sense unless every Customer has only one incoming Transaction; otherwise each incoming edge will be setting the churnProb value of its target, and only the last value will be retained. You may want to look into this.