My granddaughter was 2 1/2 when both my parents died 3 weeks apart. We took her to the first funeral and she was well behaved. We also took her to the mortuary for viewing and so she was used to the place. While we were there for the viewing she explored the building. The mortician, who did know our family, said that was alright and interacted with her too. Being there was a pleasant experience for her.
My granddaughter had only been with my parents a couple of times and she was too young to know about or be concerned about death. We told her grandma is in heaven and she reacted with a ho hum sort of attitude. Seeing my mother in the casket didn't seem to interest her either.
Having her there was helpful to the family and especially for me. She was a reminder of the life part of the cycle. The funeral was small, perhaps 25 people, and the service was short. And she did sit mostly quietly on either her mother's or my lap.
Your children are a bit older. The 4 yo may be more interested in what is happening. I think that it might make a difference if they knew their great grandfather. Then it is a time to share grief with them. The funeral makes death more real and that helps with the grieving process. If the rest of the family are OK with them attending I would take them. We didn't take her to the second funeral because my brother who does not like children nor had experience with them, asked us not to. He still doesn't like to have her around when he visits.
As to their being frightened by other's emotions; I don't think that will be a problem as long as they are with someone with whom they feel secure. However, if it is likely that someone will be hysterical and out of control then I wouldn't take them.
My granddaughter's other grandmother died about a year ago when my granddaughter was 5. The service was in AZ and we didn't go. But I think it would've been helpful for my granddaughter to have gone. She talks fairly often about her dying. Her father sent her a fleece throw with teddy bears on it and told her it was her grandma's favorite blanket. My granddaughter slept with it every night for awhile and still likes to tell me about it and talk about her grandma. She did not know her grandmother but still expresses sadness over her death. We have a strong belief in God and heaven and she does say that Grandma is in heaven but she doesn't understand what that means. I think that being at the funeral would have helped create some closure for her. It would've allowed her to see that others were sad too and talking about death would've been more than an abstract idea.