Construction of a class of loops via graphs